3 # Author: A. S. Budden <abudden _at_ gmail _dot_ com>
4 # Copyright: Copyright (C) 2009-2011 A. S. Budden
5 # Permission is hereby granted to use and distribute this code,
6 # with or without modifications, provided that this copyright
7 # notice is copied with it. Like anything else that's free,
8 # the TagHighlight plugin is provided *as is* and comes with no
9 # warranty of any kind, either expressed or implied. By using
10 # this plugin, you agree that in no event will the copyright
11 # holder be liable for any damages resulting from the use
14 # ---------------------------------------------------------------------
15 from __future__ import print_function
19 debug_log_levels = ('Critical', 'Error', 'Warning', 'Status', 'Information', 'None')
21 debug_log_level = 'None'
23 def SetDebugLogFile(filename):
25 debug_log_file = filename
27 def SetDebugLogLevel(level):
28 global debug_log_level
29 debug_log_level = level
31 def Debug(msg, level):
32 if level not in debug_log_levels:
33 raise Exception("Invalid log level: " + level)
34 this_index = debug_log_levels.index(level)
35 current_index = debug_log_levels.index(debug_log_level)
37 if this_index > current_index:
40 if debug_log_file is None:
43 fh = open(debug_log_file, 'a')