Type of the context (e.g. API, Plugin, Coremod...)
Name of the context (e.g. Notices, SilentTyping, Badges...)
Color of the prefix as hex or a CSS color
Logs an error to the console, with an identifying prefix managed by the Logger instance.
Rest
...data: [message?: any, ...optionalParams: any[]]Item(s) to print as an error
The arguments for this method are the same as the arguments for console.error
.
Logs a message to the console, with an identifying prefix managed by the Logger instance.
Rest
...data: [message?: any, ...optionalParams: any[]]Item(s) to print as a message
The arguments for this method are the same as the arguments for console.log
.
Logs a warning to the console, with an identifying prefix managed by the Logger instance.
Rest
...data: [message?: any, ...optionalParams: any[]]Item(s) to print as a warning
The arguments for this method are the same as the arguments for console.warn
.
Static
apiStatic
coremodStatic
pluginGenerated using TypeDoc
A convenient way to manage logging things to the console with colorful prefixes indicating their context. Each
Logger
instance stores its context type, context name, and prefix color, so you can use its log, warn, and error methods in the same manner that you would use theconsole
methods with the same names. The prefix will be generated and prepended to the appropriate console message automatically.If you are only logging a single message with a prefix in your plugin, you may use log, warn, or error instead of creating a
Logger
. Otherwise, using this class is much more convenient than specifying the type, name, and color for every message.Example usage: