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

@highoutput/logger

Package Overview
Dependencies
Maintainers
5
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highoutput/logger - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

2

build/index.d.ts
declare type Argument = number | string | Error | object;
declare class Logger {
private tags;
constructor(tags: string | string[]);
constructor(tags?: string | string[]);
tag(tags: string | string[]): Logger;

@@ -6,0 +6,0 @@ log(level: string, ...args: Argument[]): void;

@@ -13,21 +13,16 @@ "use strict";

constructor(tags) {
if (tags instanceof Array) {
this.tags = tags;
if (tags) {
this.tags = (tags instanceof Array) ? tags : [tags];
}
else {
this.tags = [tags];
}
}
tag(tags) {
return new Logger([
...this.tags.slice(0),
...(typeof tags === 'string' ? [tags] : tags),
...(this.tags || []).slice(0),
...((tags instanceof Array) ? tags : [tags]),
]);
}
log(level, ...args) {
const tags = [...this.tags].join(',');
const scope = `${level}${tags ? `:${tags}` : ''}`;
const logger = loggers.get(scope) || debug_1.default(scope);
if (!loggers.get(scope)) {
loggers.set(scope, logger);
const logger = loggers.get(level) || debug_1.default(level);
if (!loggers.get(level)) {
loggers.set(level, logger);
}

@@ -39,3 +34,6 @@ args

Object.getOwnPropertyNames(item).forEach(property => {
obj[property] = item[property];
obj[property] =
(typeof item[property] === 'string') ?
item[property].replace(/\n/g, '\\n') :
item[property];
});

@@ -45,3 +43,3 @@ return obj;

if (typeof item === 'string') {
return item.replace(/\n/, '\\n');
return item.replace(/\n/g, '\\n');
}

@@ -54,6 +52,3 @@ if (typeof item === 'number') {

.map(item => {
if (typeof item === 'object') {
return JSON.stringify(item);
}
return item;
return JSON.stringify(Object.assign(Object.assign({ tags: this.tags }, (process.env.SERVICE_NAME) ? { service: process.env.SERVICE_NAME } : {}), { message: item }));
})

@@ -60,0 +55,0 @@ .forEach(item => logger(item));

{
"name": "@highoutput/logger",
"version": "0.4.1",
"version": "0.5.0",
"main": "build/index.js",

@@ -30,3 +30,3 @@ "dependencies": {

},
"gitHead": "eab757e77dd61ee8efe339649c347a23c7ad155b"
"gitHead": "9777f311ea6768e63ccd056627bfdab967da59a7"
}

Sorry, the diff of this file is not supported yet

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