Usage
Typescript Import Format
//This namespace exports multiple static methods or members. To import
import * as Logger from "ojs/ojlogger";
//Now you can access the methods as Logger.methodName and so on
For additional information visit:
Fields
-
(static, constant) LEVEL_ERROR :number
-
Log level error
-
(static, constant) LEVEL_INFO :number
-
Log level info
-
(static, constant) LEVEL_LOG :number
-
Log level - general message
-
(static, constant) LEVEL_NONE :number
-
Log level none
-
(static, constant) LEVEL_WARN :number
-
Log level warning
Methods
-
(static) error(message, optionalParams) : {void}
-
Writes an error message.
Parameters:
Name Type Argument Description message
any <optional>
A function that returns the message to be logged, a string containing zero or more substitution strings, or an object to be logged. See examples in the overview section above. optionalParams
any[] Objects with which to replace substitution strings within messages or simply additional objects to be logged. - Since:
- 1.0.0
Returns:
- Type
- void
-
(static) info(message, optionalParams) : {void}
-
Writes an informational message.
Parameters:
Name Type Argument Description message
any <optional>
A function that returns the message to be logged, a string containing zero or more substitution strings, or an object to be logged. See examples in the overview section above. optionalParams
any[] Objects with which to replace substitution strings within messages or simply additional objects to be logged. - Since:
- 1.0.0
Returns:
- Type
- void
-
(static) log(message, optionalParams) : {void}
-
Writes a general message.
Parameters:
Name Type Argument Description message
any <optional>
A function that returns the message to be logged, a string containing zero or more substitution strings, or an object to be logged. See examples in the overview section above. optionalParams
any[] Objects with which to replace substitution strings within messages or simply additional objects to be logged. - Since:
- 1.0.0
Returns:
- Type
- void
-
(static) option(key, value) : {any}
-
Method for setting and getting logger option/options
Sets/gets logger configuration - level and/or writer. Accepts variable number of arguments.
Defaults:
Default level: oj.Logger.LEVEL_ERROR
Default writer: null; writes to the consoleUsages:
oj.Logger.option(optionName) gets the value associated the the specified optionName
oj.Logger.option() gets an object containing key/value pairs representing the logger options hash
oj.Logger.option(optionName, value) sets the option value associated with optionName
oj.Logger.option(options) sets one or more options for the loggerParameters:
Name Type Argument Description key
'level' | 'writer' | {level?: any, writer?: any} <optional>
value
any <optional>
- Since:
- 1.0.0
Returns:
- Type
- any
-
(static) warn(message, optionalParams) : {void}
-
Writes a warning message.
Parameters:
Name Type Argument Description message
any <optional>
A function that returns the message to be logged, a string containing zero or more substitution strings, or an object to be logged. See examples in the overview section above. optionalParams
any[] Objects with which to replace substitution strings within messages or simply additional objects to be logged. - Since:
- 1.0.0
Returns:
- Type
- void