New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

logdna-winston

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logdna-winston - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

29

index.js

@@ -5,2 +5,4 @@ const Transport = require('winston-transport');

const DEFAULT_LEVEL = 'debug';
const DEFAULT_NAME = 'LogDNA';
/*

@@ -12,4 +14,4 @@ * Support for Winston Transport

super(options);
this.name = options.name || 'LogDNA';
this.level = options.level || '';
this.name = options.name || DEFAULT_NAME;
this.level = options.level || DEFAULT_LEVEL;
this.logger = new Logger(options.key, options);

@@ -19,18 +21,21 @@ this.index_meta = options.index_meta || false;

log(level, msg, meta, callback) {
if (meta instanceof Error) { meta = { error: meta.stack || meta.toString() }; }
log(info, callback) {
info = info || {};
if (!msg && !(Object.keys(meta).length === 0 && meta.constructor === Object)) {
msg = stringify(meta, null, 2, function() { return undefined; });
if (info.error instanceof Error) {
info.error = info.error.stack || info.error.toString();
}
meta = meta || {};
let opts = {
if (!info.message) {
info.message = stringify(info, null, 2, function() { return undefined; });
}
const { level, message, index_meta, ...meta } = info;
const opts = {
level: level
, index_meta: meta.index_meta || this.index_meta
, context: meta
, index_meta: typeof info.index_meta === 'boolean' ? index_meta : this.index_meta
, context: meta || {}
};
this.logger.log(msg, opts);
this.logger.log(message, opts);
if (callback) { callback(null, true); }
}
};
{
"name": "logdna-winston",
"version": "2.0.0",
"version": "2.1.0",
"description": "LogDNA's Node.js logging module with support for Winston",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -43,2 +43,3 @@ <p align="center">

env: envName,
level: level, // Default to debug, maximum level of log, doc: https://github.com/winstonjs/winston#logging-levels
index_meta: true // Defaults to false, when true ensures meta object will be searchable

@@ -52,12 +53,14 @@ };

let meta = {
data:'Some information'
};
logger.log('info', 'Log from LogDNA-winston', meta);
logger.log('debug', 'Log from LogDNA-winston', meta);
logger.log('warn', 'Log from LogDNA-winston', meta);
logger.log('error', 'Log from LogDNA-winston', meta);
logger.info('Info: Log from LogDNA-winston', meta);
logger.warn('Warn: Log from LogDNA-winston', meta);
logger.error('Error: Log from LogDNA-winston', meta);
// log with meta
logger.log({
level: 'info'
, message: 'Log from LogDNA-winston'
, index_meta: true // Ignore this if you would like to use default setting
, data:'Some information' // Properties besides level, message and index_meta are considered as "meta"
, error: new Error("It's a trap.") // Transport will parse the error object under property 'error'
});
// log without meta
logger.info('Info: Log from LogDNA-winston');
```

@@ -64,0 +67,0 @@

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