@spinajs/log-common
Advanced tools
Comparing version 2.0.46 to 2.0.48
@@ -191,3 +191,4 @@ import { SyncService } from "@spinajs/di"; | ||
} | ||
export declare type LogVariables = ILogStaticVariables & ILogVariable; | ||
export type LogVariables = ILogStaticVariables & ILogVariable; | ||
export declare function createLogMessageObject(err: Error | string, message: string | any[], level: LogLevel, logger: string, variables: any, ...args: any[]): ILogEntry; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,34 +0,5 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (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 __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createLogMessageObject = exports.LogTarget = exports.LogLevelStrings = exports.StrToLogLevel = exports.LogLevel = void 0; | ||
const di_1 = require("@spinajs/di"); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const util = __importStar(require("util")); | ||
var LogLevel; | ||
import { SyncService } from "@spinajs/di"; | ||
import _ from "lodash"; | ||
import * as util from "util"; | ||
export var LogLevel; | ||
(function (LogLevel) { | ||
@@ -43,4 +14,4 @@ LogLevel[LogLevel["Security"] = 999] = "Security"; | ||
LogLevel[LogLevel["Trace"] = 0] = "Trace"; | ||
})(LogLevel = exports.LogLevel || (exports.LogLevel = {})); | ||
exports.StrToLogLevel = { | ||
})(LogLevel || (LogLevel = {})); | ||
export const StrToLogLevel = { | ||
trace: LogLevel.Trace, | ||
@@ -55,3 +26,3 @@ debug: LogLevel.Debug, | ||
}; | ||
exports.LogLevelStrings = { | ||
export const LogLevelStrings = { | ||
[LogLevel.Debug]: "debug", | ||
@@ -66,3 +37,3 @@ [LogLevel.Error]: "error", | ||
}; | ||
class LogTarget extends di_1.SyncService { | ||
export class LogTarget extends SyncService { | ||
constructor(options) { | ||
@@ -73,3 +44,3 @@ super(); | ||
if (options) { | ||
this.Options = lodash_1.default.merge(lodash_1.default.merge(this.Options, { | ||
this.Options = _.merge(_.merge(this.Options, { | ||
enabled: true, | ||
@@ -81,13 +52,17 @@ layout: "${datetime} ${level} ${message} ${error} (${logger})", | ||
} | ||
exports.LogTarget = LogTarget; | ||
function createLogMessageObject(err, message, level, logger, variables, ...args) { | ||
export function createLogMessageObject(err, message, level, logger, variables, ...args) { | ||
const sMsg = err instanceof Error || !err ? message : err; | ||
const tMsg = args.length !== 0 ? util.format(sMsg, ...args) : sMsg; | ||
const lName = logger !== null && logger !== void 0 ? logger : message; | ||
const lName = logger ?? message; | ||
return { | ||
Level: level, | ||
Variables: Object.assign({ error: err instanceof Error ? err : undefined, level: exports.LogLevelStrings[`${level}`].toUpperCase(), logger: lName, message: tMsg }, variables), | ||
Variables: { | ||
error: err instanceof Error ? err : undefined, | ||
level: LogLevelStrings[`${level}`].toUpperCase(), | ||
logger: lName, | ||
message: tMsg, | ||
...variables, | ||
}, | ||
}; | ||
} | ||
exports.createLogMessageObject = createLogMessageObject; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"version": "2.0.46", | ||
"version": "2.0.48", | ||
"description": "Log lib for all spinejs related libs", | ||
"main": "lib/index.js", | ||
"exports": "./lib/index.js", | ||
"type": "module", | ||
"private": false, | ||
"engines": { | ||
"node": ">=16.11" | ||
}, | ||
"scripts": { | ||
"build": "npm run clean && npm run compile", | ||
"compile": "tsc -b tsconfig.json", | ||
"rimraf": "./node_modules/rimraf/bin.js", | ||
"clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo", | ||
"test": "ts-mocha -p tsconfig.json test/**/*.test.ts", | ||
"coverage": "nyc npm run test", | ||
"build-docs": "rimraf docs && typedoc --options typedoc.json src/", | ||
"build": "npm run clean && npm run compile", | ||
"compile": "tsc -p tsconfig.build.json", | ||
"clean": "", | ||
"prepare": "npm run build", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"lint": "eslint -c .eslintrc.js --ext .ts src", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"lint": "eslint -c .eslintrc.cjs --ext .ts src --fix", | ||
"preversion": "npm run lint", | ||
"version": "npm run format && git add -A src", | ||
"postversion": "git push && git push --tags" | ||
"postinstall": "npm run build" | ||
}, | ||
@@ -42,3 +45,3 @@ "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/log)", | ||
}, | ||
"gitHead": "bd560afd6c9a156071102cc6b4f36115b5498e9d", | ||
"gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee", | ||
"dependencies": { | ||
@@ -45,0 +48,0 @@ "@spinajs/di": "^2.0.46" |
@@ -0,0 +0,0 @@ # `@spinajs/log-common` |
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
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
17775
6
Yes
254
1