Prettified all files.
This commit is contained in:
+13
-10
@@ -20,15 +20,14 @@ try {
|
||||
|
||||
/** Basic class for app specific logging requirements.
|
||||
* Can be used to implement persistent logging in electron apps.
|
||||
* Uses a logMessage cache to prevent error overflows. This is
|
||||
* Uses a logMessage cache to prevent error overflows. This is
|
||||
* needed since errors may occur very frequently
|
||||
* (e.g. display update loops at 60fps, programmatic loops, ...).
|
||||
*
|
||||
*
|
||||
* The logging handlers can be overwritten by calling the static
|
||||
* setup method.
|
||||
*/
|
||||
export default class Logging {
|
||||
|
||||
/** Static log function.
|
||||
* @param {*} message
|
||||
*/
|
||||
@@ -37,9 +36,9 @@ export default class Logging {
|
||||
}
|
||||
|
||||
/**
|
||||
* Static warn function.
|
||||
* Static warn function.
|
||||
* Emits each warning only once per session.
|
||||
* @param {*} message
|
||||
* @param {*} message
|
||||
*/
|
||||
static warn(message) {
|
||||
if (!logMessages.has(message)) {
|
||||
@@ -49,10 +48,10 @@ export default class Logging {
|
||||
}
|
||||
|
||||
/**
|
||||
* Static error function.
|
||||
* Emits each error message only once per session.
|
||||
* @param {*} message
|
||||
*/
|
||||
* Static error function.
|
||||
* Emits each error message only once per session.
|
||||
* @param {*} message
|
||||
*/
|
||||
static error(message) {
|
||||
if (!logMessages.has(message)) {
|
||||
logMessages.add(message)
|
||||
@@ -60,7 +59,11 @@ export default class Logging {
|
||||
}
|
||||
}
|
||||
|
||||
static setup({log=console.log, warn=console.warn, error=console.error} = {}) {
|
||||
static setup({
|
||||
log = console.log,
|
||||
warn = console.warn,
|
||||
error = console.error
|
||||
} = {}) {
|
||||
logHandlers.log = log
|
||||
logHandlers.warn = warn
|
||||
logHandlers.error = error
|
||||
|
||||
Reference in New Issue
Block a user