The module LoxBerry::Log contains functions for easy logging and notifications.
The logfile feature enables LoxBerry-integrated logging including logging/debugging filters set by the user. With the shortcut functions it is very easy to create log entries, and filtering corresponding to the users loglevel is done by the module.
The notify features enable notifications in the user interface (the blue and/or red bullets overlaying icons and the navigation bar).
The module automatically includes the modules
Commands of this modules can directly be accesses without use'ing them. No error occurs, if the are use'd anyway.
See the usage of this module that was especially developed for easy use with LoxBerry.
List of severities for logging
|Level||Name||Shortcut function||Object function||Use when|
|0||Emergency||LOGEMERGE||$obj->EMERGE||... your LoxBerry burns|
|1||Alert||LOGALERT||$obj->ALERT||... if the critical information also needs to be pushed to the user|
|2||Critical||LOGCRIT||$obj->CRIT||... when user intervention is needed to continue operation|
Error → Default
... when an error occurs but
This is the default value in the plugin database
|4||Warning||LOGWARN||$obj->WARN||... when something is strange but does not stop operation|
|5||Notice||LOGOK||$obj->OK||... is to inform the user that something went ok|
|6||Informational||LOGINF||$obj->INF||... additional infos to any status|
|7||Debug||LOGDEB||$obj->DEB||... for heavy debugging that a user normally don't need.|
The object functions are called directly to the log object (e.g. if you have multiple logfiles).
The Shortcut functions always log to the default log object (the first log object).
Do not log higher severity levels just because you think the user should know this.
Returns the current available logfiles, optional filtered by $package or $package and $name. Returns an array with a hashref to each logfile.
Reads the notifications, optional filtered by $package or $package and $name. Returns an array with a hashref to each notification.
Returns HTML code that shows all notifications of the specific package, and/or name and type. The HTML includes buttons to delete the notifications.
Creates a log object to do LoxBerry-specific logging to a logfile or to the standard output (stderr, stdout). The LoxBerry logging module uses the user-defined loglevel from the plugin management, therefore no plugin-own setting and own loglevel-filtering is required.
Creates an information or error notification that can be displayed in a plugin. This can be used in automated scripts like daemons or cronjobs to notify the user about good or bad news about the status of your plugin.
Creates an information or error notification with extended attributes. Use this function, if you want to store more information in your notification than a simple LoxBerry::Log::notify.
To debug the module, use that code in your program:
This will send debugging messages to STDERR.