class lib.log.Log(smarthome, name, mapping, maxlen=40, handler=None)[Quellcode]

Bases: deque


Adds a log entry to the memory log. If the log already has reached the maximum length, the oldest entry is removed from the log automatically.


Assuming dt to be a datetime: remove all entries that are smaller or equal to this given datetime from the right side of the queue


Returns the newest entries of the log and prepares them with the mapping


number – Number of entries to return


List of log entries


Returns the newest entries of the log


number – Number of entries to return


List of log entries

class lib.log.Logs(sh)[Quellcode]

Bases: object

DBGHIGH_level = 13
DBGLOW_level = 11
DBGMED_level = 12
NOTICE_level = 29
add_log(name, log)[Quellcode]

Adds a log (object) to the list of memory logs

  • name – Name of log

  • log – Log object

add_logging_level(description, value)[Quellcode]

Adds a new Logging level to the standard python logging

  • description (string) – appearance within logs SYSINFO

  • value (int) – numeric value for the logging level

  • tocall (String, optional, if not given description will be used with lower case) – function name to call for a log with the given level

no error checking is performed here for typos, already existing levels or functions

configure_logging(config_dict, config_filename='logging.yaml')[Quellcode]

This function initializes all needed datastructures to use the ‚env.core.log‘ mem-logger and the (old) memlog plugin

It adds the handler log_mem (based on the custom lib.log.ShngMemLogHandler) to the root logger It logs all WARNINGS from all (old) mem-loggers to the root Logger


Function to the list of memory logs


List of logs



root_handler_name = ''
class lib.log.ShngMemLogHandler(logname='undefined', maxlen=35, level=0)[Quellcode]

Bases: StreamHandler

LogHandler used by MemLog


Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‚encoding‘ attribute, it is used to determine how to do the output to the stream.

class lib.log.ShngTimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None)[Quellcode]

Bases: TimedRotatingFileHandler

TimedRotatingFilehandler with a different naming scheme for rotated files


do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix.


Determine the files to delete when rolling over.

More specific than the earlier method, which just used glob.glob().