BAC0.core.utils package

Submodules

BAC0.core.utils.notes module

Notes and logger decorator to be used on class This will add a “notes” object to the class and will allow logging feature at the same time. Goal is to be able to access quickly to important informations for the web interface.

class BAC0.core.utils.notes.LogList[source]

Bases: object

LOGGERS = [<Logger BAC0_Root.BAC0.core.io.Read.ReadProperty (DEBUG)>, <Logger BAC0_Root.BAC0.core.io.Write.WriteProperty (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.Discover.NetworkServiceElementWithRequests (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.Discover.Discover (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.GetIPAddr.HostIP (DEBUG)>, <Logger BAC0_Root.BAC0.core.app.ScriptApplication.BAC0Application (DEBUG)>, <Logger BAC0_Root.BAC0.core.app.ScriptApplication.BAC0ForeignDeviceApplication (DEBUG)>, <Logger BAC0_Root.BAC0.core.app.ScriptApplication.BAC0BBMDDeviceApplication (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.TaskManager.Manager (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.TaskManager.Task (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.TaskManager.OneShotTask (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.Poll.SimplePoll (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.Poll.DevicePoll (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.Poll.DeviceNormalPoll (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.Poll.DeviceFastPoll (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.Match.Match (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.Match.Match_Value (DEBUG)>, <Logger BAC0_Root.BAC0.core.devices.Points.Point (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.DoOnce.DoOnce (DEBUG)>, <Logger BAC0_Root.BAC0.core.devices.Trends.TrendLog (DEBUG)>, <Logger BAC0_Root.BAC0.core.devices.Virtuals.VirtualPoint (DEBUG)>, <Logger BAC0_Root.BAC0.core.devices.Device.Device (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.TimeSync.TimeSync (DEBUG)>, <Logger BAC0_Root.BAC0.scripts.Base.LocalObjects (DEBUG)>, <Logger BAC0_Root.BAC0.scripts.Base.Base (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.Reinitialize.Reinitialize (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.DeviceCommunicationControl.DeviceCommunicationControl (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.Schedule.Schedule (DEBUG)>, <Logger BAC0_Root.BAC0.core.functions.Calendar.Calendar (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.RecurringTask.RecurringTask (DEBUG)>, <Logger BAC0_Root.BAC0.tasks.UpdateCOV.Update_local_COV (DEBUG)>, <Logger BAC0_Root.BAC0.scripts.Lite.Lite (DEBUG)>, <Logger BAC0_Root.BAC0.core.devices.local.object.ObjectFactory (DEBUG)>]
BAC0.core.utils.notes.convert_level(level)[source]
BAC0.core.utils.notes.note_and_log(cls)[source]

This will be used as a decorator on class to activate logging and store messages in the variable cls._notes This will allow quick access to events in the web app. A note can be added to cls._notes without logging if passing the argument log=false to function note() Something can be logged without addind a note using function log()

BAC0.core.utils.notes.update_log_level(level=None, *, log_file=None, stderr=None, stdout=None, log_this=True)[source]
Typical usage ::

# Silence (use CRITICAL so not much messages will be sent) BAC0.log_level(‘silence’) # Verbose BAC0.log_level(‘info’) # Default, Info on console….but Warning in file BAC0.log_level(file=’warning’, stdout=’info’, stderr=’critical’) # Debug in file and console… this is a bad idea as the console will be filled BAC0.log_level(file=’debug’, stdout=’debug’, stderr=’critical’)

# Preferably, debug in the file, keep console limited to info BAC0.log_level(‘debug’) # OR BAC0.log_level(file=’debug’, stdout=’info’, stderr=’critical’)

Giving only one parameter will set file and console to the same level. I tend to keep stderr CRITICAL

Module contents