@spinajs/log
Advanced tools
Comparing version 1.0.7 to 1.0.8
/// <reference types="node" /> | ||
import { Writable } from 'stream'; | ||
import { Configuration } from '@spinajs/configuration'; | ||
import { SyncModule } from '@spinajs/di'; | ||
import { Writable } from "stream"; | ||
import { Configuration } from "@spinajs/configuration"; | ||
import { SyncModule } from "@spinajs/di"; | ||
/** | ||
@@ -6,0 +6,0 @@ * ----------------------------------------------------------------------------------- |
@@ -5,2 +5,14 @@ "use strict"; | ||
// tslint:disable: unified-signatures | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -12,12 +24,12 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -27,2 +39,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SpinaJsDefaultLog = exports.LogModule = exports.ConsoleLogStream = exports.Logger = void 0; | ||
const bunyan = __importStar(require("bunyan")); | ||
@@ -52,3 +65,3 @@ const chalk_1 = __importDefault(require("chalk")); | ||
if (!logger) { | ||
logger = di_1.DI.get('LogModule').getLogger(options); | ||
logger = di_1.DI.get("LogModule").getLogger(options); | ||
} | ||
@@ -61,3 +74,3 @@ return logger; | ||
enumerable: false, | ||
configurable: false, | ||
configurable: false | ||
}); | ||
@@ -88,3 +101,5 @@ }; | ||
const type = this._getNameFromType(chunk.level); | ||
const err = chunk.err ? `Exception: ${chunk.err.name}, ${chunk.err.message}, ${chunk.err.stack}` : ""; | ||
const err = chunk.err | ||
? `Exception: ${chunk.err.name}, ${chunk.err.message}, ${chunk.err.stack}` | ||
: ""; | ||
const message = `${chunk.time.toISOString()} ${type} ${chunk.name}: ${chunk.msg} (module=${chunk.module}) ${err}`; | ||
@@ -118,13 +133,13 @@ let c = null; | ||
case this.TRACE: | ||
return 'TRACE'; | ||
return "TRACE"; | ||
case this.DEBUG: | ||
return 'DEBUG'; | ||
return "DEBUG"; | ||
case this.INFO: | ||
return 'INFO'; | ||
return "INFO"; | ||
case this.WARN: | ||
return 'WARN'; | ||
return "WARN"; | ||
case this.ERROR: | ||
return 'ERROR'; | ||
return "ERROR"; | ||
case this.FATAL: | ||
return 'FATAL'; | ||
return "FATAL"; | ||
} | ||
@@ -139,3 +154,3 @@ } | ||
const DEFAULT_OPTIONS = { | ||
name: 'spine-framework', | ||
name: "spine-framework", | ||
serializers: bunyan.stdSerializers, | ||
@@ -147,3 +162,3 @@ /** | ||
{ | ||
type: 'raw', | ||
type: "raw", | ||
/** | ||
@@ -153,5 +168,5 @@ * We use default console log stream with colors | ||
stream: new ConsoleLogStream(), | ||
level: process.env.NODE_ENV === 'development' ? 'trace' : 'info', | ||
}, | ||
], | ||
level: process.env.NODE_ENV === "development" ? "trace" : "info" | ||
} | ||
] | ||
}; | ||
@@ -178,3 +193,3 @@ /** | ||
*/ | ||
this.name = 'Log'; | ||
this.name = "Log"; | ||
} | ||
@@ -193,4 +208,4 @@ /** | ||
// get config | ||
this.log = bunyan.createLogger(this.cfg.get(['log'], DEFAULT_OPTIONS)); | ||
process.on('uncaughtException', (err) => { | ||
this.log = bunyan.createLogger(this.cfg.get(["log"], DEFAULT_OPTIONS)); | ||
process.on("uncaughtException", (err) => { | ||
this.log.fatal(err); | ||
@@ -197,0 +212,0 @@ }); |
{ | ||
"name": "@spinajs/log", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Log lib for all spinejs related libs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21013
452