Const
Displays the passed in strings on the console provided log level is 4 or higher
Rest
...values: (undefined | null | string | number)[]strings, numbers, nulls, undefined all concatenated with space separator to form the log message
Displays the passed in strings on the console provided log level is 1 or higher
Rest
...values: (undefined | null | string | number)[]strings, numbers, nulls, undefined all concatenated with space separator to form the log message
Current Logging Level:
current logging level as a numeric (0 - 5)
Displays the passed in strings on the console provided log level is 3 or higher
Rest
...values: (undefined | null | string | number)[]strings, numbers, nulls, undefined all concatenated with space separator to form the log message
Sets the current logging level. Possible values are:
string or numeric representing the required level of logging
Displays the passed in strings on the console provided log level is 3 or higher
Rest
...values: (undefined | null | string | number)[]strings, numbers, nulls, undefined all concatenated with space separator to form the log message
Displays the passed in strings on the console together with the stack trace provided log level is 5
Rest
...values: (undefined | null | string | number)[]strings, numbers, nulls, undefined all concatenated with space separator to form the log message
Displays the passed in strings on the console provided log level is 2 or higher
Rest
...values: (undefined | null | string | number)[]strings, numbers, nulls, undefined all concatenated with space separator to form the log message
Generated using TypeDoc
Logger provides a way to annotate code to provide logging, but also allows logging to be turned off (or down) depending on requirements.
The Log Level (detail of logging reported) is taken from command line argument eg.
or can be selected in code with log.setLevel()
Example:
Using logger in your code:
Place log messages at the appropriate level throughout your code. If they don't log anything, they will run very quickly.
Assuming your application is started with a logging level of 'warn' or 2, the following will be output from the above code:
0:00:00.071 ⚠ file failed to download
Whereas if your application is started with a logging level of 'debug' or 5:
Initialising log level on the command line
When you start your code, the command line setting will determine the logging level. If none is set on the command line the default is 2 (warn) if in a 'production' environment, or 3 (info/success) if not.