A super simple singleton wrapper around the Javascript console.
By default includes info, log, warn, and error methods.
It may be expanded further using the addMethod method.
- Source:
Members
(static) handler
A custom handler.
If a function, it will be called to handle all method calls.
If an Array, it will have all log entries added as objects with
at least time, method, and opts properties.
By default and arguments property will also be included.
See msgArguments and msgArgs for further details.
If the boolean value false, all output will be thrown into the void.
If it is an object, then each property name represents a method name,
and the values will be treated as a handler for that method only.
All handler types are supported (i.e. function, Array, or false.)
A special method name of DEFAULT may be specified as a default handler
for method names not explicitly specified in the object.
If no DEFAULT is specified and there is no handler value for a method
name, calls to it will be passed through to the real console object.
If no handler was set, all methods are passed to the real console object.
Default value: null
- Source:
(static) methodArg
Use the method name as the first argument in function calls.
Default value: true
- Source:
(static) msgArgs
The name to include the args array in the log.
Only applicable if handler is an Array.
Default value: "arguments"
- Source:
(static) msgArguments
The name to include the arguments magic object in the log.
Only applicable if handler is an Array.
This used to be hard-coded as "arguments" but the shortArgs
option has replaced it as the array is simpler for most purposes.
Default value: null
- Source:
(static, constant) real
A reference to the real console object.
- Source:
(static) returnMsg
Return the message object?
Only applicable if handler is an Array.
If true, return the message object.
If false, returns undefined.
Default value: false
- Source:
Methods
(static) addMethod(method)
Add a wrapper method to the console wrapper object.
Parameters:
| Name | Type | Description |
|---|---|---|
method |
string | The console method to wrap. |
- Source: