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

modular-log

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modular-log - npm Package Compare versions

Comparing version 0.0.6 to 0.1.0

lib/summarizer.d.ts

7

examples/basic-example.js
"use strict";
var log = require('../lib/index');
// Create project level console log
log.createConsoleLogger({
log.setupConsoleLogger({
level: 'trace',
});
// Cretate project level file log
log.createFileLogger({
log.setupFileLogger({
filename: 'outfile.log',
level: 'warn',
});
log.setupSummarizer();
var cnt = 0; // Helper variable

@@ -26,1 +27,3 @@ // First logger object

logger2.warn('Another guy here');
var sum = log.sumLog();
logger2.debug('Sum without this message', sum);
import * as log from '../lib/index';
// Create project level console log
log.createConsoleLogger({
log.setupConsoleLogger({
level: 'trace',

@@ -9,3 +9,3 @@ });

// Cretate project level file log
log.createFileLogger({
log.setupFileLogger({
filename: 'outfile.log',

@@ -15,2 +15,4 @@ level: 'warn',

log.setupSummarizer();
let cnt = 0; // Helper variable

@@ -33,1 +35,3 @@

logger2.warn('Another guy here');
let sum = log.sumLog();
logger2.debug('Sum without this message', sum);

@@ -18,4 +18,8 @@ import * as winston from 'winston';

};
export declare function createConsoleLogger(options: any): void;
export declare function createFileLogger(options: any): void;
export declare function setupConsoleLogger(options: any): void;
export declare function setupFileLogger(options: any): void;
export declare function setupSummarizer(): void;
export declare function sumLog(): {
[index: string]: number;
};
export declare function createLogger(module: string): Logger;

@@ -6,5 +6,6 @@ "use strict";

var colors = require('colors/safe');
var summarizer_1 = require('./summarizer');
exports.levels = { fatal: 0, error: 1, warn: 2, info: 3, debug: 4, trace: 5 };
var levelColors = { fatal: 'bgRed', error: 'red', warn: 'yellow', info: 'cyan', debug: 'blue', trace: 'blue' };
var createRewriter = function (module) {
function createRewriter(module) {
return function (level, msg, meta) {

@@ -15,3 +16,4 @@ meta.at = Date.now();

};
};
}
;
function createFormatter(useColors) {

@@ -34,8 +36,9 @@ return function (options) {

var transports = [];
function createConsoleLogger(options) {
var summarizer = null;
function setupConsoleLogger(options) {
options.formatter = createFormatter(true);
transports.push(new winston.transports.Console(options));
}
exports.createConsoleLogger = createConsoleLogger;
function createFileLogger(options) {
exports.setupConsoleLogger = setupConsoleLogger;
function setupFileLogger(options) {
options.formatter = createFormatter();

@@ -45,3 +48,10 @@ options.json = false;

}
exports.createFileLogger = createFileLogger;
exports.setupFileLogger = setupFileLogger;
function setupSummarizer() {
summarizer = new summarizer_1.Summarizer();
transports.push(summarizer);
}
exports.setupSummarizer = setupSummarizer;
function sumLog() { return summarizer ? summarizer.cnt : {}; }
exports.sumLog = sumLog;
function createLogger(module) {

@@ -48,0 +58,0 @@ return new winston.Logger({

{
"name": "modular-log",
"version": "0.0.6",
"version": "0.1.0",
"description": "Modular components based on Winston logger",

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

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