Class: Logger

Logger

Logger

new Logger(theName, theLevel)

Constructor-Method of Class Logger
Name Type Description
theName String the name / ID for the logger
theLevel String | Number optional OPTIONAL the log-level. If omitted, the logger will use the default log-level
See:

Members

cfunction

Alias for critical.

dfunction

Alias for debug.

efunction

Alias for error.

ifunction

Alias for info.

iscfunction

Alias for isCritical.

isdfunction

Alias for isDebug.

isefunction

Alias for isError.

privateisFullStackDepthBoolean

setting for trace-depth (i.e. stack-depth)

isifunction

Alias for isInfo.

isvfunction

Alias for isVerbose.

iswfunction

Alias for isWarn.

lfunction

Alias for log.

privatepnOriginalfunction

proxy object for storing the original implementation of Logger.prototype#print function. (only used, if tracing is enabled!)

privatepnTraceOptionsObject

options object for tracing

privatetmpTraceConfigObject

configuration value for enabling/disabling tracing in log-output

vfunction

Alias for verbose.

wfunction

Alias for warn.

Methods

privatecreateErr(){string}

Creates error message (with stack trace, if possible).
Returns:
Type Description
string the error message

privatecreateMsg(){string}

creates the message text.
Returns:
Type Description
string the message text

critical(className, funcName, msg, error)

Print a critical (exception) log message, if at least critical (5) log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message
error Error optional OPTIONAL an error object: if available, its message and error-stack will be print to the output

debug(className, funcName, msg)

Print a debug log message, if at least debug (1) log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message

error(className, funcName, msg, error)

Print an error log message, if at least error (4) log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message
error Error optional OPTIONAL an error object: if available, its message and error-stack will be print to the output

privategetAsLevel(strLogLevel){Number}

Get the log-level as number.
Name Type Description
strLogLevel String the string representation for the log-level
See:
Returns:
Type Description
Number the log-level as number

getLevel(){Number}

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
See:
Returns:
Type Description
Number the logging level

info(className, funcName, msg)

Print an information log message, if at least info (2) log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message

isCritical(){Boolean}

Check if the current log-level is at least critical.
See:
Returns:
Type Description
Boolean true if at least log-level critical (5)

isDebug(){Boolean}

Check if the current log-level is at least debug.
See:
Returns:
Type Description
Boolean true if at least log-level debug (1)

isDisabled(){Boolean}

Check if the current log-level is at least disabled.
See:
Returns:
Type Description
Boolean true if at least log-level disable (6)

privateisErr(){Boolean}

HELPER: check if errObj is an Error
Returns:
Type Description
Boolean

isError(){Boolean}

Check if the current log-level is at least error.
See:
Returns:
Type Description
Boolean true if at least log-level error (4)

isInfo(){Boolean}

Check if the current log-level is at least info.
See:
Returns:
Type Description
Boolean true if at least log-level info (2)

isVerbose(){Boolean}

Check if the current log-level is at least verbose.
See:
Returns:
Type Description
Boolean true if at least log-level verbose (0)

isWarn(){Boolean}

Check if the current log-level is at least warn.
See:
Returns:
Type Description
Boolean true if at least log-level warn (3)

log(className, funcName, msg, error)

Print a log message, if at least debug log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message
error Error optional OPTIONAL an error object: if available, its message and error-stack will be print to the output

privateprint()

privateprinte()

print log message with error information.

privateprintFullStack()

Extension for Logger.prototype#print function with tracing. This extension prints the full stack trace in log-output. (only used, if tracing is enabled!)

privateprintStack()

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.
Name Type Description
loggingLevel String | Number if {Number} the logging level as a number if {String} the logging level as a string (see getLevel)
See:

verbose(className, funcName, msg)

Print a verbose log message, if at least verbose (0) log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message

warn(className, funcName, msg)

Print a warning log message, if at least warn (3) log-level is set.
Name Type Description
className String optional OPTIONAL the name of the class/object from which the logging is invoked from
funcName String optional OPTIONAL the name of the function (within the class) from which the logging is invoked from
msg String the log message