Classes | |
class | PreciseFormatter |
Functions | |
def | configure_common_logging |
def | configure_custom_logging |
def | configure_custom_logging_file |
def | get_common_logging_configuration |
def | get_log_config_file_path |
def | parse_log_buffer |
Variables | |
tuple | log_file_path = os.path.join(os.path.expanduser("~"), '.log') |
dictionary | log_level |
string | re_category = '\\[(.*?)\s*\\]' |
string | re_fill = '.*?' |
string | re_generic_log_entry = '^' |
string | re_host = '\s*([^\s]+)\s*' |
string | re_level = '\\[(.*?)\s*\\]' |
string | re_msg = '((?:.*\n?)(?:^(?!{}).*\n?)*)' |
string | re_ncl_log_entry = '^' |
string | re_ncl_time_stamp = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}' |
string | re_source = '\s*([^\s]+)\s*\\:' |
string | re_syslog_time_stamp = '[A-Z][a-z]{2,}\s+\d{1,2} \d{2}:\d{2}:\d{2}' |
string | re_timestamp = '({}|{})' |
tuple | rg_generic_log_entry = re.compile(re_generic_log_entry,re.MULTILINE) |
tuple | rg_ncl_log_entry = re.compile(re_ncl_log_entry,re.MULTILINE) |
def nasa_common_logging.logging_utils.configure_common_logging | ( | level = 'INFO' , |
|
handlers = ["syslog" , |
|||
console, | |||
file_path = None |
|||
) |
Configure the default logging scheme, with just a few override options. @type level string @param level log level of the root handler as a string. @type handlers list-of-strings @param handlers List of named handlers. Valid handlers are "syslog", "console", "file", or "socket". @type file_path string @param file_path Path to the log file, if the 'file' appender is used. If file_path is just a file name, the logfile will be placed in the default location (/home/$USER/.log/<file_path>). Otherwise the entire path will be used.
Definition at line 39 of file logging_utils.py.
Configure the root logger with a custom config. NOTE: One could call get_common_logging_configuration(), modify the contents, and simply call this method as an easy means of changing the logging configuration
Definition at line 149 of file logging_utils.py.
def nasa_common_logging.logging_utils.configure_custom_logging_file | ( | config_file | ) |
Configure the root logger from a JSON-format logging config file.
Definition at line 159 of file logging_utils.py.
Return the common logging configuration as a dictionary. When invoked, this method will create the folder ~/.log, if it does not exist
Definition at line 80 of file logging_utils.py.
Definition at line 33 of file logging_utils.py.
def nasa_common_logging.logging_utils.parse_log_buffer | ( | buffer | ) |
Parse log entries from a buffer. This buffer could be a portion, or an entire log file. This method will only detect and properly parse log messages that are formatted using the nasa_common_logging default log format. For syslog, this is logs using the "syslog" formatter or the "precise" formatter. For formatter definitions, see "get_common_logging_configuration" Args: buffer: A single string from a nasa_common_logging formatted log file. Returns: List of log entries. Each entry is a tuple: (timestamp, source, tag, loglevel, message)
Definition at line 199 of file logging_utils.py.
tuple nasa_common_logging::logging_utils::log_file_path = os.path.join(os.path.expanduser("~"), '.log') |
Definition at line 30 of file logging_utils.py.
00001 { 00002 'CRITICAL': logging.CRITICAL, 00003 'critical': logging.CRITICAL, 00004 'DEBUG': logging.DEBUG, 00005 'debug': logging.DEBUG, 00006 'ERROR': logging.ERROR, 00007 'error': logging.ERROR, 00008 'FATAL': logging.FATAL, 00009 'fatal': logging.FATAL, 00010 'INFO': logging.INFO, 00011 'info': logging.INFO, 00012 'WARN': logging.WARNING, 00013 'warn': logging.WARNING, 00014 'WARNING': logging.WARNING, 00015 'warning': logging.WARNING 00016 }
Definition at line 13 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_category = '\\[(.*?)\s*\\]' |
Definition at line 180 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_fill = '.*?' |
Definition at line 172 of file logging_utils.py.
Definition at line 196 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_host = '\s*([^\s]+)\s*' |
Definition at line 177 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_level = '\\[(.*?)\s*\\]' |
Definition at line 179 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_msg = '((?:.*\n?)(?:^(?!{}).*\n?)*)' |
Definition at line 181 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_ncl_log_entry = '^' |
Definition at line 193 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_ncl_time_stamp = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}' |
Definition at line 174 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_source = '\s*([^\s]+)\s*\\:' |
Definition at line 178 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_syslog_time_stamp = '[A-Z][a-z]{2,}\s+\d{1,2} \d{2}:\d{2}:\d{2}' |
Definition at line 173 of file logging_utils.py.
string nasa_common_logging::logging_utils::re_timestamp = '({}|{})' |
Definition at line 176 of file logging_utils.py.
tuple nasa_common_logging::logging_utils::rg_generic_log_entry = re.compile(re_generic_log_entry,re.MULTILINE) |
Definition at line 197 of file logging_utils.py.
tuple nasa_common_logging::logging_utils::rg_ncl_log_entry = re.compile(re_ncl_log_entry,re.MULTILINE) |
Definition at line 194 of file logging_utils.py.