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

@ekolabs/logger

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ekolabs/logger - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

14

config.js
module.exports = {
DEFAULT_STREAM: {
"production": "logger_stream",
"staging": "logger_stream_staging"
'production': 'logger_stream',
'staging': 'logger_stream_staging'
},
DEFAULT_REGION: "us-east-1",
DEFAULT_LOG_LEVEL: "log",
DEFAULT_ENVIRONMENT: "staging",
DB_ATTRIBUTES: ["service_id", "task_id", "taskparent_id", "task_type", "reporter", "log", "log_level", "task_time"]
}
DEFAULT_REGION: 'us-east-1',
DEFAULT_LOG_LEVEL: 'log',
DEFAULT_ENVIRONMENT: 'staging',
DB_ATTRIBUTES: ['service_id', 'task_id', 'taskparent_id', 'task_type', 'reporter', 'log', 'log_level', 'task_time']
};

@@ -1,12 +0,14 @@

const fs = require("fs");
const when = require("when");
const config = require("./config");
'use strict';
const fs = require('fs');
const when = require('when');
const config = require('./config');
// all known reporters, including the base class
let reporterModules = fs.readdirSync("./reporters");
let reporterModules = fs.readdirSync('./reporters');
let reporterConstructors = {};
reporterModules.map(m => { m = m.replace('.js',''); reporterConstructors[m] = require(`./reporters/${m}`); });
// the log levels
const logLevels = ['debug', 'info', 'log', 'warn', 'error'];
// the log levels. Ordered by increasing urgency
const logLevels = ['trace', 'debug', 'info', 'log', 'warn', 'error'];

@@ -26,24 +28,24 @@ /**

* args = {
* reporter: "encoding",
* service_id: "100"
* reporter: 'encoding',
* service_id: '100'
* };
*
* options = {
* environment: "staging",
* environment: 'staging',
* reporters: {
* file: {
* logFileName: "file_with_logs.txt",
* minLevel: "debug"
* logFileName: 'file_with_logs.txt',
* minLevel: 'debug'
* },
* sentry: {
* sentryDSN: "sentry DSN string",
* minLevel: "error"
* sentryDSN: 'sentry DSN string',
* minLevel: 'error'
* },
* firehose: {
* AWSOptions: {
* "DeliveryStream": "aaa",
* "region": "bbb",
* "credentials": "instance of AWS.Credentials",
* "accessKeyId": "AAAA",
* "secretAccessKey": "BBBB"
* 'DeliveryStream': 'aaa',
* 'region': 'bbb',
* 'credentials': 'instance of AWS.Credentials',
* 'accessKeyId': 'AAAA',
* 'secretAccessKey': 'BBBB'
* }

@@ -54,5 +56,5 @@ * }

*
* Each reporter can be supplied a "minLevel" attribute. This attribute will
* Each reporter can be supplied a 'minLevel' attribute. This attribute will
* limit which events are transmitted to this reporter. The levels are, in ascending
* order: debug, info, log, warn, error. So if minLevel is set to "log", then all
* order: debug, info, log, warn, error. So if minLevel is set to 'log', then all
* events at the debug and info level will not be transmitted.

@@ -67,3 +69,3 @@ */

this.options.reporters = this.options.reporters || {};
this.options.environment = this.options.environment || "staging";
this.options.environment = this.options.environment || 'staging';

@@ -77,16 +79,16 @@ // Validate

for (var reporterName in this.options.reporters) {
var options = this.options.reporters[reporterName];
let options = this.options.reporters[reporterName];
options.environment = this.options.environment;
this.reporters[reporterName] = new reporterConstructors[reporterName](options);
};
}
};
/**
* The log functions.
* The logging functions.
*
* Call this function to log a message
* NOTE: syntactic sugar functions (warn, debug, error, info) will log
* Call these functions to log a message
* NOTE: syntactic sugar functions (trace, debug, info, warn, error) will log
* the message at the corresponding log level
*
* @method log
* @method warn
* @param {String} message The message string to log

@@ -99,3 +101,3 @@ * @param {Object} args Attributes for reporter and service_id that may override the defaults provided on the constructor

EkoLogger.prototype.reportLogLevel.call(this, level, msg, args);
}
};
});

@@ -131,4 +133,5 @@

} catch (e) {
if (this.options.verbose)
if (this.options.verbose) {
console.log(`reporter ${reporter.name} failed ${e.toString()}`);
}
}

@@ -138,3 +141,3 @@ }

return when.all(promises);
}
};

@@ -148,3 +151,3 @@ // check if this reporter should process events for this level

// put unrecognized attributes in the "overflows" attribute inside a JSON-encoded string.
// put unrecognized attributes in the 'overflows' attribute inside a JSON-encoded string.
// This functionality simplifies reporters such as Firehose which require

@@ -161,4 +164,4 @@ // a strict set of primary attributes.

obj.overflows = JSON.stringify(obj.overflows);
}
};
module.exports = EkoLogger;
{
"name": "@ekolabs/logger",
"version": "1.0.1",
"version": "1.0.2",
"dependencies": {

@@ -5,0 +5,0 @@ "aws-sdk": "^2.2.25",

# Eko Logger README #
The Eko Logger is a library which provides a set of logging functions (debug, info, log, warn, error).
The Eko Logger is a library which provides a set of logging functions (trace, debug, info, warn, error).
Eko services such as encoding and publishing use the Eko Logger to record various logging events, for purposes of auditing and debugging. In those cases, the log messages are transmitted to the Eko back-end servers.

@@ -31,2 +31,3 @@

var EkoLogger = require('@helloeko/logger');
var loggerArgs = {

@@ -36,2 +37,3 @@ reporter: 'niftyService',

};
var loggerOptions = {

@@ -56,8 +58,11 @@ environment: 'staging',

};
var logger = new EkoLogger(args, loggerOptions);
logger.log("omg what a lovely readme!");
logger.info("you should check out this readme");
logger.debug("someone just read the readme");
logger.error("readme is too long", {task_id: 'ca13caab-f7ae-4534-bd6b-99e0555a4f6e'});
logger.warn("readme is rather boring", {task_id: 'ca13caab-f7ae-4534-bd6b-99e0555a4f6e'});
var logger = new EkoLogger(loggerArgs, loggerOptions);
logger.trace('omg what a lovely readme!');
logger.debug('someone just read the readme');
logger.info('you should check out this readme');
logger.warn('readme is rather boring', {task_id: 'ca13caab-f7ae-4534-bd6b-99e0555a4f6e'});
logger.error('readme is too long', {task_id: 'ca13caab-f7ae-4534-bd6b-99e0555a4f6e'});
```
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