diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..0602bdb --- /dev/null +++ b/404.html @@ -0,0 +1,638 @@ + + + +
+ + + + + + + + + + + + + + + + +Using the verbose option
+configure_logging(verbose=2)
+
+Or using a named log level
+configure_logging(levels='debug')
+
+or using a numeric value
+configure_logging(levels=10)
+
+configure_logging(levels ={"console": 'debug', "file": 'trace'})
+
+configure_logging({"file": 'trace'})
+
+configure_logging(modules=['MyPackage'])
+
+configure_logging(levels='debug', modules=['MyPackage'])
+
+configure_logging(log_file_path='my_log')
+
+configure_logging(config="dual_rotating", backup_count=3)
+
+configure_logging(config='file')
+
+Any combination of parameters can be combined to achieve the desired logging configuration.
+configure_logging(levels='debug', modules=['MyPackage'], log_file_path='logs', backup_count=10, config='dual_rotating)
+
+
+
+
+
+
+
+ configure_logging(config=None, verbose=None, levels=None, modules=None, log_file_path=None, backup_count=None, **kwargs) -> SimpleLoggingConfig
+
+This is the primary API used to configure logging for a script/program. +Returns a SimpleLoggingConfig object
+configure_logging() takes 6 optional parameters
+Additionally, behaviour can also be modified by the use of environment variables.
+Note: Names use "_" separator in the function signature as opposed to "-" in command line parameters.
+Note: Some behaviours can only be updated by the use of environemnt variables.
See API Examples for example use cases.
+The options verbose and levels are mutually exclusive. Both can be used to adjust the logging levels. If levels is defined then this will be used in preference to verbose.
+Verbose is an integer used to change the logging level of the default handler:
+If no parameter is provided then the environment variable "SLC_VERBOSE" will be used. +If no environment variable is defined then the logging levels are unchanged.
+levels sets the log level for specific handlers.
+This can either a single value or a dictionary where the key is the name of the handler and the value the level to apply to that handler. If a single value is provided, this is applied to the default handler. The level value can be an integer or string representing a named level.
e.g.
+If no parameter is provided then the environment variable "SLC_LEVELS" will be used. +If no environment variable is defined then the logging levels are unchanged.
+modules is a list of modules names that logging should be enabled for. No other modules will emit any log messages. If this value is unset then logging will be enabled for all modules. +Default behaviour is to enable logging for all modules.
+If no parameter is provided then the environment variable "SLC_MODULES" will be used. +If no environemnt variable is provided, logging shall be enabled for all modules
+log_file_path is used to set the path (or filename) to use when logging to file. If file logging is not supported by the selected config this parameter is ignored. +If log_file_path is an existing folder, the log is saved to this folder, using the name of the calling script, with a ".log" suffix. Else it is assumed that log_file_path specifies a filename that should be used to save the log to in the current working directory.
+If no paramter is provided then the environment variable "SLC_LOG_FILE_PATH" will be used.
+If no environment variable is defined then the log file will be saved to the current working directory with the name of the calling script and a .log file extension.
The path can be selected when initialising SimpleLoggingConfig for the first time. Once set it cannot be changed.
+This parameter has no effect if used with a config that does not support logging to file.
+backup_count is the number of backup copies of log files to retain.
+If no paramter is provided then the environment variable "SLC_BACKUP_COUNT" will be used.
+If no environment variable is defined this default to 5.
This parameter has no effect if used with a config that does not support rotating file handlers.
+The name of the config to use for logging.
+The following are supported configs and their associated handlers and formats used for each handler:
+If no paramter is provided then the environment variable "SLC_CONFIG" will be used. +If no environment variable is defined then the config named "dual" will be used.
+There are 2 formatters defined for the various configs.
+Formatters can be modified by the use of environment variables. If a custom formatter is required, the environemnt variable must be set before logging is initialised.
+Create an environment variable with the name: SLC_[HANDLER_NAME]_FORMAT, where HANDLER_NAME is the name of a defined handler, in uppercase. e.g. CONSOLE, FILE or ROTATING_FILE
+e.g. To display the log level along with the message for the console logging handler.
+set SLC_CONSOLE_FORMAT=%(levelname)s %(message)s
+
+Note: Setting this value incorrectly may cause logging to raise an exception.
+SimpleLoggingConfig(config=None, verbose=None, levels=None, modules=None, log_file_path=None, backup_count=None, **kwargs)
+
+The class used to implement logging configuration
+An instance of SimpleLoggingConfig is returned by configure_logging(), or it can be initialised directly.
+Used to adjust logging levels post initialisation.
+set_levels(levels)
+
+Where level is a single value or a dictionary. If a single value is provided, this is applied to the default handler. If a dictionary is provided, the key represents the name of the handler and the value the log level to apply to that handler. The level value can be an integer or string representing a named level.
+Call doRollover on any handlers that support log rotation
+rotate()
+
+Tear down SimpleLoggingConfig. Used for testing only
+reset()
+
+
+
+
+
+
+
+ If you write CLI programs using ArgumentParser, support is included to simplify configuring logging in a standard fashion.
+Calling add_logging_arguments(parser) with a parser object as a parameter will add the following paramters to your script.
+Having called parser.parse_args(), the return value can be passed into configure_logging() as follows:
+configure_logging(**vars(args))
+
+The following example shows how to add logging support to your CLI program.
+# test.py
+
+from argparse import ArgumentParser
+from simple_logging_config import add_logging_arguments
+from simple_logging_config import configure_logging
+
+parser = ArgumentParser(description='Example Program')
+add_logging_arguments(parser)
+
+args = parser.parse_args()
+configure_logging(**vars(args))
+
+# Call your code here
+
+Running the above program with the -h param will result in the following output
+usage: test.py [-h] [-v | --slc-levels [SLC_LEVELS ...]] [--slc-modules [SLC_MODULES ...]] [--slc-log-file-path SLC_LOG_FILE_PATH] [--slc-backup-count SLC_BACKUP_COUNT]
+ [--slc-config {dual,dual_rotating,dual_detailed,console,file,rotating_file}]
+
+Example Program
+
+options:
+ -h, --help show this help message and exit
+ -v, --verbose The level of logging verbosity for the default handler. Use multiple times (up to -vvv) for increased
+ verbosity.
+ --slc-level LEVELS, --slc-levels LEVELS
+ The log level(s) to be applied to attached handlers. This value can be a single integer or a string
+ representing a defined log level. Or it can be a string representing a dictionary where key/value pairs
+ are handler names and the log level to be associated with that handler
+ --slc-modules [MODULES ...]
+ The names of the modules to be logged. If omitted all modules are logged.
+ --slc-log-file-path LOG_FILE_PATH
+ The path the log file will be saved to. If this is a folder, the log file will be saved to this folder
+ with the file name derived from the name of the calling script. Otherwise, assume this is a full path to
+ a named log file.
+ --slc-backup-count BACKUP_COUNT
+ An integer specifying The number of backup log files to retain.
+ --slc-config {dual,dual_rotating,dual_detailed,console,file,rotating_file}
+ The name of the logging config to be used.
+
+
+
+
+
+
+
+ {"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Ha=/["'&<>]/;Un.exports=$a;function $a(e){var t=""+e,r=Ha.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i