Class Logger
Logger
Defined in: logger.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Logger(theName, theLevel)
Constructor-Method of Class Logger
|
Method Attributes | Method Name and Description |
---|---|
c()
Alias for #critical.
|
|
<private> |
createErr(msg, error)
Creates error message (with stack trace, if possible).
|
<private> |
createMsg(className, funcName, msg)
creates the message text.
|
critical(className, funcName, msg, error)
Print a critical (exception) log message, if at least
critical (5) log-level is set. |
|
d()
Alias for #debug.
|
|
debug(className, funcName, msg)
Print a debug log message, if at least
debug (1) log-level is set. |
|
e()
Alias for #error.
|
|
error(className, funcName, msg, error)
Print an error log message, if at least
error (4) log-level is set. |
|
<private> |
getAsLevel(strLogLevel)
Get the log-level as number.
|
getLevel()
Get the current log-level:
if a specific log-level for this Logger instance is set,
this value is returned.
|
|
i()
Alias for #info.
|
|
info(className, funcName, msg)
Print an information log message, if at least
info (2) log-level is set. |
|
isc()
Alias for #isCritical.
|
|
isCritical(loggerName)
Check if the current log-level is at least
critical . |
|
isd()
Alias for #isDebug.
|
|
isDebug(loggerName)
Check if the current log-level is at least
debug . |
|
isDisabled(loggerName)
Check if the current log-level is at least
disabled . |
|
ise()
Alias for #isError.
|
|
<private> |
isErr(errObj)
HELPER: check if errObj is an Error
|
isError(loggerName)
Check if the current log-level is at least
error . |
|
isi()
Alias for #isInfo.
|
|
isInfo(loggerName)
Check if the current log-level is at least
info . |
|
isv()
Alias for #isVerbose.
|
|
isVerbose(loggerName)
Check if the current log-level is at least
verbose . |
|
isw()
Alias for #isWarn.
|
|
isWarn(loggerName)
Check if the current log-level is at least
warn . |
|
l()
Alias for #log.
|
|
log(className, funcName, msg, error)
Print a log message, if at least
debug log-level is set. |
|
<private> |
print(loggerName, logLevel, msg)
|
<private> |
printe(loggerName, logLevel, className, funcName, msg, error)
print log message with error information.
|
<private> |
Extension for Logger.prototype#print function with tracing.
|
<private> |
Extension for Logger.prototype#print function with tracing.
|
setLevel(loggingLevel)
Set the logging level.
|
|
v()
Alias for #verbose.
|
|
verbose(className, funcName, msg)
Print a verbose log message, if at least
verbose (0) log-level is set. |
|
w()
Alias for #warn.
|
|
warn(className, funcName, msg)
Print a warning log message, if at least
warn (3) log-level is set. |
Class Detail
Logger(theName, theLevel)
Constructor-Method of Class Logger
- Parameters:
- {String} theName
- the name / ID for the logger
- {String|Number} theLevel Optional
- OPTIONAL the log-level. If omitted, the logger will use the default log-level
- See:
- #getAsLevel
- #getLevel
Method Detail
c()
Alias for #critical.
<private>
{string}
createErr(msg, error)
Creates error message (with stack trace, if possible).
- Parameters:
- msg
- error
- Returns:
- {string} the error message
<private>
{string}
createMsg(className, funcName, msg)
creates the message text.
- Parameters:
- className
- funcName
- msg
- Returns:
- {string} the message text
critical(className, funcName, msg, error)
Print a critical (exception) log message, if at least
critical
(5) log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message
- {Error} error Optional
- OPTIONAL an error object: if available, its message and error-stack will be print to the output
d()
Alias for #debug.
debug(className, funcName, msg)
Print a debug log message, if at least
debug
(1) log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message
e()
Alias for #error.
error(className, funcName, msg, error)
Print an error log message, if at least
error
(4) log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message
- {Error} error Optional
- OPTIONAL an error object: if available, its message and error-stack will be print to the output
<private>
{Number}
getAsLevel(strLogLevel)
Get the log-level as number.
- Parameters:
- {String} strLogLevel
- the string representation for the log-level
- Returns:
- {Number} the log-level as number
- See:
- #getLevel
{Number}
getLevel()
Get the current log-level:
if a specific log-level for this Logger instance is set,
this value is returned.
Otherwise, the default log-level as returned by mmir.Logging#getDefaultLogLevel
is used.
Log-levels:
- 0: verbose
- 1: debug
- 2: info
- 3: warn
- 4: error
- 5: critical
- 6: disabled
- Returns:
- {Number} the logging level
- See:
- #setLevel
i()
Alias for #info.
info(className, funcName, msg)
Print an information log message, if at least
info
(2) log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message
isc()
Alias for #isCritical.
{Boolean}
isCritical(loggerName)
Check if the current log-level is at least
critical
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-levelcritical
(5)
- See:
- #critical
isd()
Alias for #isDebug.
{Boolean}
isDebug(loggerName)
Check if the current log-level is at least
debug
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-leveldebug
(1)
- See:
- #debug
{Boolean}
isDisabled(loggerName)
Check if the current log-level is at least
disabled
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-leveldisable
(6)
- See:
- #getLevel
ise()
Alias for #isError.
<private>
{Boolean}
isErr(errObj)
HELPER: check if errObj is an Error
- Parameters:
- errObj
- Returns:
- {Boolean}
{Boolean}
isError(loggerName)
Check if the current log-level is at least
error
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-levelerror
(4)
- See:
- #error
isi()
Alias for #isInfo.
{Boolean}
isInfo(loggerName)
Check if the current log-level is at least
info
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-levelinfo
(2)
- See:
- #info
isv()
Alias for #isVerbose.
{Boolean}
isVerbose(loggerName)
Check if the current log-level is at least
verbose
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-levelverbose
(0)
- See:
- #verbose
isw()
Alias for #isWarn.
{Boolean}
isWarn(loggerName)
Check if the current log-level is at least
warn
.
- Parameters:
- loggerName
- Returns:
- {Boolean}
true
if at least log-levelwarn
(3)
- See:
- #warn
l()
Alias for #log.
log(className, funcName, msg, error)
Print a log message, if at least
debug
log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message
- {Error} error Optional
- OPTIONAL an error object: if available, its message and error-stack will be print to the output
<private>
print(loggerName, logLevel, msg)
- Parameters:
- loggerName
- logLevel
- msg
<private>
printe(loggerName, logLevel, className, funcName, msg, error)
print log message with error information.
- Parameters:
- loggerName
- logLevel
- className
- funcName
- msg
- error
<private>
printFullStack()
Extension for Logger.prototype#print function with tracing.
This extension prints the full stack trace in log-output.
(only used, if tracing is enabled!)
<private>
printStack()
Extension for Logger.prototype#print function with tracing.
This extension prints only the first entry of the stack trace in log-output.
(only used, if tracing is enabled!)
setLevel(loggingLevel)
Set the logging level.
- Parameters:
- {String|Number} loggingLevel
- if {Number} the logging level as a number if {String} the logging level as a string (see #getLevel)
- See:
- #getLevel
v()
Alias for #verbose.
verbose(className, funcName, msg)
Print a verbose log message, if at least
verbose
(0) log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message
w()
Alias for #warn.
warn(className, funcName, msg)
Print a warning log message, if at least
warn
(3) log-level is set.
- Parameters:
- {String} className Optional
- OPTIONAL the name of the class/object from which the logging is invoked from
- {String} funcName Optional
- OPTIONAL the name of the function (within the class) from which the logging is invoked from
- {String} msg
- the log message