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

@arashi/logger

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arashi/logger - npm Package Compare versions

Comparing version 0.0.0-dev.3 to 0.0.0-dev.4

76

lib/Logger.js

@@ -17,6 +17,3 @@ "use strict";

super();
if (!logLocation) {
logLocation = process.cwd();
}
this._logLocation = Path.resolve(logLocation);
this._logLocation = logLocation ? Path.resolve(logLocation) : null;
this._filters = this._getDefaultLogFilters();

@@ -35,2 +32,37 @@ this._serviceName = serviceName;

});
let transports = [consoleTransport];
if (this._logLocation) {
transports.push(new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.json.log`),
level: logLevel,
format: Winston.format.combine(Winston.format.json(), Winston.format.errors({ stack: true }), Winston.format((info, opts) => {
const MESSAGE = Symbol.for('message');
info[MESSAGE] = utils.inspect({
level: info.level,
message: info.message,
timestamp: info.timestamp,
service: info.service,
component: info.component,
meta: info.meta
}, {
depth: Infinity,
colors: false,
maxArrayLength: Infinity,
showProxy: true,
breakLength: Infinity
});
return info;
})())
}));
transports.push(new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.log`),
level: logLevel,
format: Winston.format.combine(Winston.format.simple(), Winston.format.errors({ stack: true }), format)
}));
transports.push(new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.errors.log`),
level: LogLevel_1.LogLevel.WARN,
format: Winston.format.combine(Winston.format.simple(), Winston.format.errors({ stack: true }), format)
}));
}
this._logger = Winston.createLogger({

@@ -44,37 +76,3 @@ level: logLevel,

},
transports: [
consoleTransport,
new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.json.log`),
level: logLevel,
format: Winston.format.combine(Winston.format.json(), Winston.format.errors({ stack: true }), Winston.format((info, opts) => {
const MESSAGE = Symbol.for('message');
info[MESSAGE] = utils.inspect({
level: info.level,
message: info.message,
timestamp: info.timestamp,
service: info.service,
component: info.component,
meta: info.meta
}, {
depth: Infinity,
colors: false,
maxArrayLength: Infinity,
showProxy: true,
breakLength: Infinity
});
return info;
})())
}),
new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.log`),
level: logLevel,
format: Winston.format.combine(Winston.format.simple(), Winston.format.errors({ stack: true }), format)
}),
new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.errors.log`),
level: LogLevel_1.LogLevel.WARN,
format: Winston.format.combine(Winston.format.simple(), Winston.format.errors({ stack: true }), format)
})
]
transports: transports
});

@@ -81,0 +79,0 @@ }

{
"name": "@arashi/logger",
"version": "0.0.0-dev.3",
"version": "0.0.0-dev.4",
"description": "Logger",

@@ -5,0 +5,0 @@ "main": "./lib/api.js",

@@ -37,7 +37,3 @@ // Copyright (C) 2020 Norman Breau

if (!logLocation) {
logLocation = process.cwd();
}
this._logLocation = Path.resolve(logLocation);
this._logLocation = logLocation ? Path.resolve(logLocation) : null;

@@ -66,2 +62,51 @@ this._filters = this._getDefaultLogFilters();

let transports: Array<Winston.transport> = [ consoleTransport ];
if (this._logLocation) {
transports.push(new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.json.log`),
level: logLevel,
format: Winston.format.combine(
Winston.format.json(),
Winston.format.errors({ stack: true }),
Winston.format((info: Winston.Logform.TransformableInfo, opts?: any): Winston.Logform.TransformableInfo => {
const MESSAGE: any = Symbol.for('message');
info[MESSAGE] = utils.inspect({
level: info.level,
message: info.message,
timestamp: info.timestamp,
service: info.service,
component: info.component,
meta: info.meta
}, {
depth: Infinity,
colors: false,
maxArrayLength: Infinity,
showProxy: true,
breakLength: Infinity
});
return info;
})()
)
}));
transports.push(new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.log`),
level: logLevel,
format: Winston.format.combine(
Winston.format.simple(),
Winston.format.errors({ stack: true }),
format
)
}));
transports.push(new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.errors.log`),
level: LogLevel.WARN,
format: Winston.format.combine(
Winston.format.simple(),
Winston.format.errors({ stack: true }),
format
)
}));
}
this._logger = Winston.createLogger({

@@ -78,49 +123,3 @@ level: logLevel,

},
transports: [
consoleTransport,
new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.json.log`),
level: logLevel,
format: Winston.format.combine(
Winston.format.json(),
Winston.format.errors({ stack: true }),
Winston.format((info: Winston.Logform.TransformableInfo, opts?: any): Winston.Logform.TransformableInfo => {
const MESSAGE: any = Symbol.for('message');
info[MESSAGE] = utils.inspect({
level: info.level,
message: info.message,
timestamp: info.timestamp,
service: info.service,
component: info.component,
meta: info.meta
}, {
depth: Infinity,
colors: false,
maxArrayLength: Infinity,
showProxy: true,
breakLength: Infinity
});
return info;
})()
)
}),
new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.log`),
level: logLevel,
format: Winston.format.combine(
Winston.format.simple(),
Winston.format.errors({ stack: true }),
format
)
}),
new Winston.transports.File({
filename: Path.resolve(this._logLocation, `${serviceName}.errors.log`),
level: LogLevel.WARN,
format: Winston.format.combine(
Winston.format.simple(),
Winston.format.errors({ stack: true }),
format
)
})
]
transports: transports
});

@@ -127,0 +126,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