Socket
Socket
Sign inDemoInstall

@spinajs/log

Package Overview
Dependencies
Maintainers
1
Versions
277
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spinajs/log - npm Package Compare versions

Comparing version 1.2.26 to 1.2.30

2

lib/decorators.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const di_1 = require("@spinajs/di");

@@ -5,0 +7,0 @@ const log_1 = require("./log");

8

lib/log.d.ts

@@ -9,3 +9,2 @@ import { Container, SyncModule } from "@spinajs/di";

Name: string;
Variables?: any;
protected Parent?: Log;

@@ -19,2 +18,3 @@ /**

static Loggers: Map<string, Log>;
Timers: Map<string, Date>;
static clearLoggers(): void;

@@ -25,4 +25,8 @@ protected static AttachedToExitEvents: boolean;

protected Targets: ILogTargetDesc[];
protected Variables: Record<string, any>;
protected Container: Container;
constructor(Name: string, Variables?: any, Parent?: Log);
constructor(Name: string, variables?: Record<string, unknown>, Parent?: Log);
addVariable(name: string, value: unknown): void;
timeStart(name: string): void;
timeEnd(name: string): number;
resolve(): void;

@@ -29,0 +33,0 @@ trace(message: string, ...args: any[]): void;

@@ -41,7 +41,9 @@ "use strict";

let Log = Log_1 = class Log extends di_1.SyncModule {
constructor(Name, Variables, Parent) {
constructor(Name, variables, Parent) {
super();
this.Name = Name;
this.Variables = Variables;
this.Parent = Parent;
this.Timers = new Map();
this.Variables = {};
this.Variables = variables !== null && variables !== void 0 ? variables : {};
}

@@ -51,2 +53,20 @@ static clearLoggers() {

}
addVariable(name, value) {
this.Variables[`${name}`] = value;
}
timeStart(name) {
if (this.Timers.has(name)) {
return;
}
this.Timers.set(name, new Date());
}
timeEnd(name) {
if (this.Timers.has(name)) {
const cTime = new Date();
const diff = cTime.getTime() - this.Timers.get(name).getTime();
this.Timers.delete(name);
return diff;
}
return 0;
}
resolve() {

@@ -53,0 +73,0 @@ const config = this.Container.get(types_1.Configuration);

@@ -48,6 +48,7 @@ "use strict";

varMatch.forEach((v) => {
var _a, _b;
if (vars && vars[v[2]]) {
const fVar = vars[v[2]];
if (fVar instanceof Function) {
result = result.replace(v[0], fVar());
result = result.replace(v[0], fVar((_a = v[4]) !== null && _a !== void 0 ? _a : null));
}

@@ -62,8 +63,3 @@ else {

// optional parameter eg. {env:PORT}
if (v[4]) {
result = result.replace(v[0], variable.Value(v[4]));
}
else {
result = result.replace(v[0], variable.Value());
}
result = result.replace(v[0], variable.Value((_b = v[4]) !== null && _b !== void 0 ? _b : null));
}

@@ -70,0 +66,0 @@ else {

{
"name": "@spinajs/log",
"version": "1.2.26",
"version": "1.2.30",
"description": "Log lib for all spinejs related libs",

@@ -29,6 +29,6 @@ "main": "lib/index.js",

"dependencies": {
"@spinajs/configuration": "^1.2.26",
"@spinajs/di": "^1.2.26",
"@spinajs/configuration": "^1.2.30",
"@spinajs/di": "^1.2.30",
"@spinajs/exceptions": "^1.2.7",
"@spinajs/log-common": "^1.2.7",
"@spinajs/log-common": "^1.2.30",
"ajv": "^8.8.2",

@@ -45,3 +45,3 @@ "colors": "^1.4.0",

},
"gitHead": "db0a4879ea356c677f78938201ddf93e032e1e63"
"gitHead": "06aef45008bf43baf2d1a91917a1a1eaa23a15cc"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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