Simple logger for debugging purposes
Note: "methods" in this module are actually "static" functions - see hs.logger.new()
| Signature | hs.logger.defaultLogLevel |
|---|---|
| Type | Variable |
| Description | Default log level for new logger instances. The starting value is 'warning'; set this (to e.g. 'info') at the top of your |
| Signature | hs.logger.history() -> list of log entries |
|---|---|
| Type | Function |
| Description | Returns the global log history Parameters:
Returns:
|
| Signature | hs.logger.historySize([size]) -> number |
|---|---|
| Type | Function |
| Description | Sets or gets the global log history size Parameters:
Returns:
Notes:
|
| Signature | hs.logger.new(id, loglevel) -> logger |
|---|---|
| Type | Function |
| Description | Creates a new logger instance Parameters:
Returns:
Notes:
Example: local log = hs.logger.new('mymodule','debug')
log.i('Initializing') -- will print "[mymodule] Initializing" to the console
|
| Signature | hs.logger.printHistory([entries[, level[, filter[, caseSensitive]]]]) |
|---|---|
| Type | Function |
| Description | Prints the global log history to the console Parameters:
Returns:
|
| Signature | hs.logger.setGlobalLogLevel(lvl) |
|---|---|
| Type | Function |
| Description | Sets the log level for all logger instances (including objects' loggers) Parameters:
Returns:
|
| Signature | hs.logger.setModulesLogLevel(lvl) |
|---|---|
| Type | Function |
| Description | Sets the log level for all currently loaded modules Parameters:
Returns:
Notes:
|
| Signature | hs.logger.level |
|---|---|
| Type | Field |
| Description | The log level of the logger instance, as a number between 0 and 5 |
| Signature | hs.logger:d(...) |
|---|---|
| Type | Method |
| Description | Logs debug info to the console Parameters:
Returns:
|
| Signature | hs.logger:df(fmt,...) |
|---|---|
| Type | Method |
| Description | Logs formatted debug info to the console Parameters:
Returns:
|
| Signature | hs.logger:e(...) |
|---|---|
| Type | Method |
| Description | Logs an error to the console Parameters:
Returns:
|
| Signature | hs.logger:ef(fmt,...) |
|---|---|
| Type | Method |
| Description | Logs a formatted error to the console Parameters:
Returns:
|
| Signature | hs.logger:f(fmt,...) |
|---|---|
| Type | Method |
| Description | Logs formatted info to the console Parameters:
Returns:
|
| Signature | hs.logger:getLogLevel() -> number |
|---|---|
| Type | Method |
| Description | Gets the log level of the logger instance Parameters:
Returns:
|
| Signature | hs.logger:i(...) |
|---|---|
| Type | Method |
| Description | Logs info to the console Parameters:
Returns:
|
| Signature | hs.logger:setLogLevel(loglevel) |
|---|---|
| Type | Method |
| Description | Sets the log level of the logger instance Parameters:
Returns:
|
| Signature | hs.logger:v(...) |
|---|---|
| Type | Method |
| Description | Logs verbose info to the console Parameters:
Returns:
|
| Signature | hs.logger:vf(fmt,...) |
|---|---|
| Type | Method |
| Description | Logs formatted verbose info to the console Parameters:
Returns:
|
| Signature | hs.logger:w(...) |
|---|---|
| Type | Method |
| Description | Logs a warning to the console Parameters:
Returns:
|
| Signature | hs.logger:wf(fmt,...) |
|---|---|
| Type | Method |
| Description | Logs a formatted warning to the console Parameters:
Returns:
|