TagHighlight / plugin / TagHighlight / module /

#!/usr/bin/env python
# Tag Highlighter:
#   Author:  A. S. Budden <abudden _at_ gmail _dot_ com>
# Copyright: Copyright (C) 2009-2013 A. S. Budden
#            Permission is hereby granted to use and distribute this code,
#            with or without modifications, provided that this copyright
#            notice is copied with it. Like anything else that's free,
#            the TagHighlight plugin is provided *as is* and comes with no
#            warranty of any kind, either expressed or implied. By using
#            this plugin, you agree that in no event will the copyright
#            holder be liable for any damages resulting from the use
#            of this software.

# ---------------------------------------------------------------------
from __future__ import print_function

import os

debug_log_levels = ('None', 'Critical', 'Error', 'Warning', 'Status', 'Information')
debug_log_file = None
debug_log_level = 'None'

def SetDebugLogFile(filename):
    global debug_log_file
    debug_log_file = filename

def SetDebugLogLevel(level):
    global debug_log_level
    debug_log_level = level

def Debug(msg, level):
    if level not in debug_log_levels:
        raise Exception("Invalid log level: " + level)
    this_index = debug_log_levels.index(level)
    current_index = debug_log_levels.index(debug_log_level)

    if this_index > current_index:

    if debug_log_file is None:
        fh = open(debug_log_file, 'a')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.