Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@4lch4/logger

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4lch4/logger - npm Package Compare versions

Comparing version 1.8.4 to 1.9.0

51

dist/index.js

@@ -18,10 +18,22 @@ "use strict";

info(msg, ...optionalParams) {
console.log(this.formatter.formatMsg(msg, index_js_1.Level.info), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
if (optionalParams.length > 0) {
console.log(this.formatter.formatMsg(msg, index_js_1.Level.info), optionalParams);
}
else
console.log(msg);
}
warn(msg, ...optionalParams) {
console.log(this.formatter.formatMsg(msg, index_js_1.Level.warn), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
if (optionalParams.length > 0) {
console.warn(this.formatter.formatMsg(msg, index_js_1.Level.warn), optionalParams);
}
else
console.warn(this.formatter.formatMsg(msg, index_js_1.Level.warn));
}
debug(msg, ...optionalParams) {
if (process.env.DEBUG) {
console.log(this.formatter.formatMsg(msg, index_js_1.Level.debug), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
if (optionalParams.length > 0) {
console.log(this.formatter.formatMsg(msg, index_js_1.Level.debug), optionalParams);
}
else
console.log(this.formatter.formatMsg(msg, index_js_1.Level.debug));
}

@@ -31,16 +43,37 @@ }

if (msg instanceof Error) {
console.error(this.formatter.formatMsg(msg.message, index_js_1.Level.error), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
if (optionalParams.length > 0) {
console.error(this.formatter.formatMsg(msg.message, index_js_1.Level.error), optionalParams);
}
else
console.error(this.formatter.formatMsg(msg.message, index_js_1.Level.error));
}
else if (msg instanceof String) {
console.error(this.formatter.formatMsg(msg, index_js_1.Level.error), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
else if (typeof msg === 'string') {
if (optionalParams.length > 0) {
console.error(this.formatter.formatMsg(msg, index_js_1.Level.error), optionalParams);
}
else
console.error(this.formatter.formatMsg(msg, index_js_1.Level.error));
}
else {
console.error(this.formatter.formatMsg(msg, index_js_1.Level.error), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
if (optionalParams.length > 0) {
console.error(this.formatter.formatMsg(JSON.stringify(msg), index_js_1.Level.error), optionalParams);
}
else {
console.error(this.formatter.formatMsg(JSON.stringify(msg), index_js_1.Level.error));
}
}
}
success(msg, ...optionalParams) {
console.log(this.formatter.formatMsg(msg, index_js_1.Level.success), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
const msgOut = this.formatter.formatMsg(msg, index_js_1.Level.success);
if (optionalParams.length > 0)
console.log(msgOut, optionalParams);
else
console.log(msgOut);
}
log(msg, level, ...optionalParams) {
console.log(this.formatter.formatMsg(msg, level), optionalParams.length > 0 ? optionalParams.join('\n') : undefined);
const msgOut = this.formatter.formatMsg(msg, level);
if (optionalParams.length > 0)
console.log(msgOut, optionalParams);
else
console.log(msgOut);
}

@@ -47,0 +80,0 @@ }

2

package.json
{
"name": "@4lch4/logger",
"displayName": "Logger",
"version": "1.8.4",
"version": "1.9.0",
"description": "A small utility for logging to console within NodeJS/TypeScript applications.",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

@@ -11,3 +11,3 @@ /*

* File Created — 2021-10-07 @ 13:12:22-05:00
* Last Modified — 2022-06-17 @ 01:27:12-05:00
* Last Modified — 2022-06-17 @ 01:34:18-05:00
* Modified By — Devin W. Leaman (4lch4) (hey@4lch4.email)

@@ -55,6 +55,5 @@ * —————————————————————————————————————————————————————————————————————————————

info(msg: string | Object, ...optionalParams: any[]): void {
console.log(
this.formatter.formatMsg(msg, Level.info),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
if (optionalParams.length > 0) {
console.log(this.formatter.formatMsg(msg, Level.info), optionalParams)
} else console.log(msg)
}

@@ -70,6 +69,5 @@

warn(msg: string | Object, ...optionalParams: any[]): void {
console.log(
this.formatter.formatMsg(msg, Level.warn),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
if (optionalParams.length > 0) {
console.warn(this.formatter.formatMsg(msg, Level.warn), optionalParams)
} else console.warn(this.formatter.formatMsg(msg, Level.warn))
}

@@ -86,6 +84,5 @@

if (process.env.DEBUG) {
console.log(
this.formatter.formatMsg(msg, Level.debug),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
if (optionalParams.length > 0) {
console.log(this.formatter.formatMsg(msg, Level.debug), optionalParams)
} else console.log(this.formatter.formatMsg(msg, Level.debug))
}

@@ -108,16 +105,26 @@ }

if (msg instanceof Error) {
console.error(
this.formatter.formatMsg(msg.message, Level.error),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
} else if (msg instanceof String) {
console.error(
this.formatter.formatMsg(msg, Level.error),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
if (optionalParams.length > 0) {
console.error(
this.formatter.formatMsg(msg.message, Level.error),
optionalParams
)
} else console.error(this.formatter.formatMsg(msg.message, Level.error))
} else if (typeof msg === 'string') {
if (optionalParams.length > 0) {
console.error(
this.formatter.formatMsg(msg, Level.error),
optionalParams
)
} else console.error(this.formatter.formatMsg(msg, Level.error))
} else {
console.error(
this.formatter.formatMsg(msg as Object, Level.error),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
if (optionalParams.length > 0) {
console.error(
this.formatter.formatMsg(JSON.stringify(msg), Level.error),
optionalParams
)
} else {
console.error(
this.formatter.formatMsg(JSON.stringify(msg), Level.error)
)
}
}

@@ -134,6 +141,6 @@ }

success(msg: string, ...optionalParams: any[]): void {
console.log(
this.formatter.formatMsg(msg, Level.success),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
const msgOut = this.formatter.formatMsg(msg, Level.success)
if (optionalParams.length > 0) console.log(msgOut, optionalParams)
else console.log(msgOut)
}

@@ -149,6 +156,6 @@

log(msg: string, level: any, ...optionalParams: any[]): void {
console.log(
this.formatter.formatMsg(msg, level),
optionalParams.length > 0 ? optionalParams.join('\n') : undefined
)
const msgOut = this.formatter.formatMsg(msg, level)
if (optionalParams.length > 0) console.log(msgOut, optionalParams)
else console.log(msgOut)
}

@@ -155,0 +162,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc