@sidneys/logger
Advanced tools
Comparing version 1.12.0 to 1.13.0
@@ -77,3 +77,3 @@ 'use strict' | ||
info: 'âšī¸', | ||
warn: 'â ī¸', | ||
warn: 'â ī¸ ', | ||
error: 'đ¨' | ||
@@ -207,3 +207,3 @@ } | ||
console.log( | ||
`${parsed.emoji} %c[%s] %c %c%s%c %c%s%c %s`, | ||
`${parsed.emoji} %c %s| %c %c%s%c %c%s%c %s`, | ||
//%c | ||
@@ -249,3 +249,3 @@ `background-color: rgba(${parsed.rgb}, 0.2); color: rgba(${parsed.rgb}, 0.8); padding: 0 0px; font-weight: normal`, | ||
console.log(util.format( | ||
`${parsed.emoji} [%s] %s %s %s`, | ||
`${parsed.emoji} %s| %s %s %s`, | ||
//[%s] | ||
@@ -275,3 +275,14 @@ parsed.thread ? parsed.chalk(parsed.namespace) : parsed.chalk.underline(parsed.namespace), | ||
/** | ||
* @typedef {Object} logger | ||
* @module logger | ||
*/ | ||
/** | ||
* @typedef {Object} LoggerOptions | ||
* @property {String} namespace | ||
* @property {Boolean} timestamp | ||
* @property {Boolean} write | ||
*/ | ||
/** | ||
* @typedef {Object} Logger | ||
* @property {function} debug | ||
@@ -284,9 +295,8 @@ * @property {function} log | ||
/** | ||
* @exports logger | ||
* @param {Object} options - Logger options | ||
* @returns {logger} | ||
* | ||
* @param {LoggerOptions=} options - Logger Options | ||
* @returns {Logger} | ||
*/ | ||
module.exports = (options) => { | ||
module.exports = (options = {}) => { | ||
/** | ||
@@ -324,3 +334,3 @@ * Get root (top-level) modules' info | ||
// Use package name as namespace | ||
namespace = ` ââ ${requiringModuleName}` | ||
namespace = `âĻ${requiringModuleName}` | ||
} else { | ||
@@ -333,5 +343,7 @@ // Use filename as namespace | ||
* Default Options | ||
* @type {LoggerOptions} | ||
* @const | ||
* @default | ||
*/ | ||
let defaultOptions = { | ||
const defaultLoggerOptions = { | ||
namespace: namespace, | ||
@@ -343,3 +355,3 @@ timestamp: true, | ||
// Resolve to currentOptions by merging in defaults | ||
const currentOptions = _.defaultsDeep(options, defaultOptions) | ||
const currentOptions = _.defaultsDeep(options, defaultLoggerOptions) | ||
@@ -364,8 +376,8 @@ // Attach current options to module.exports object | ||
return { | ||
debug() { if (isDebug) { print('debug', Array.from(arguments))} }, | ||
log() { print('log', Array.from(arguments)) }, | ||
info() { print('log', Array.from(arguments)) }, | ||
warn() { print('warn', Array.from(arguments)) }, | ||
error() { print('error', Array.from(arguments)) } | ||
debug: function () { if (isDebug) { print('debug', Array.from(arguments)) } }, | ||
log: function () { print('log', Array.from(arguments)) }, | ||
info: function () { print('log', Array.from(arguments)) }, | ||
warn: function () { print('warn', Array.from(arguments)) }, | ||
error: function () { print('error', Array.from(arguments)) } | ||
} | ||
} |
{ | ||
"name": "@sidneys/logger", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"description": "ES6-based logger with focus on Electron cross-platform Desktop apps", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60407
317