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(args) → {void}
-
Writes an error message.
Parameters:
Name Type Description argsObject | string | number The method supports a variable number of arguments, string substitutions and accepts a function as a parameter. See examples in the overview section above. - Since:
- 1.0.0
Returns:
- Type
- void
-
(static) info(args) → {void}
-
Writes an informational message.
Parameters:
Name Type Description argsObject | string | number The method supports a variable number of arguments, string substitutions and accepts a function as a parameter. See examples in the overview section above. - Since:
- 1.0.0
Returns:
- Type
- void
-
(static) log(args) → {void}
-
Writes a general message.
Parameters:
Name Type Description argsObject | string | number The method supports a variable number of arguments, string substitutions and accepts a function as a parameter. See examples in the overview section above. - Since:
- 1.0.0
Returns:
- Type
- void
-
(static) option(key, value)
-
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 keyObject | string <optional>
valueany <optional>
- Since:
- 1.0.0
Example
Overriding default options
oj.Logger.option("level", oj.Logger.LEVEL_INFO); oj.Logger.option("writer", customWriter); //an object that implements the following methods: log(), info(), warn(), error() -
(static) warn(args) → {void}
-
Writes a warning message.
Parameters:
Name Type Description argsObject | string | number The method supports a variable number of arguments, string substitutions and accepts a function as a parameter. See examples in the overview section above. - Since:
- 1.0.0
Returns:
- Type
- void