@spinajs/log-common
Advanced tools
Comparing version 1.2.79 to 1.2.81
@@ -0,1 +1,2 @@ | ||
import { SyncModule } from "@spinajs/di"; | ||
export declare enum LogLevel { | ||
@@ -118,13 +119,2 @@ Security = 999, | ||
maxArchiveFiles: number; | ||
/** | ||
* Buffer size for incoming log messages. Messages are stored in buffer before write to file. | ||
* | ||
* Default is 8kb | ||
*/ | ||
bufferSize: number; | ||
/** | ||
* Time in ms after whitch flush will be forced. If set to 0 feature is disabled ( any data hangin in temp buffer will not be saved before it reaches bufferSize) | ||
* Default time is 10s. | ||
*/ | ||
flushTimeout: number; | ||
}; | ||
@@ -145,3 +135,16 @@ } | ||
} | ||
export declare abstract class LogTarget<T extends ICommonTargetOptions> extends SyncModule { | ||
HasError: boolean; | ||
Error: Error | null | unknown; | ||
Options: T; | ||
constructor(options: T); | ||
abstract write(data: ILogEntry): void; | ||
} | ||
export interface ILogTargetDesc { | ||
instance: LogTarget<ICommonTargetOptions>; | ||
options?: ITargetsOption; | ||
rule: ILogRule; | ||
} | ||
export interface ILog { | ||
Targets: ILogTargetDesc[]; | ||
trace(message: string, ...args: any[]): void; | ||
@@ -148,0 +151,0 @@ trace(err: Error, message: string, ...args: any[]): void; |
@@ -25,4 +25,9 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createLogMessageObject = exports.LogLevelStrings = exports.StrToLogLevel = exports.LogLevel = void 0; | ||
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")); | ||
@@ -60,2 +65,16 @@ var LogLevel; | ||
}; | ||
class LogTarget extends di_1.SyncModule { | ||
constructor(options) { | ||
super(); | ||
this.HasError = false; | ||
this.Error = null; | ||
if (options) { | ||
this.Options = lodash_1.default.merge(lodash_1.default.merge(this.Options, { | ||
enabled: true, | ||
layout: "${datetime} ${level} ${message} ${error} (${logger})", | ||
}), options); | ||
} | ||
} | ||
} | ||
exports.LogTarget = LogTarget; | ||
function createLogMessageObject(err, message, level, logger, variables, ...args) { | ||
@@ -62,0 +81,0 @@ const sMsg = err instanceof Error ? message : err; |
{ | ||
"version": "1.2.79", | ||
"version": "1.2.81", | ||
"description": "Log lib for all spinejs related libs", | ||
@@ -42,3 +42,6 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "ae595f5daffb88372496b6e5bf38973f07e33683" | ||
"gitHead": "dd58385e770069586eb8814a13365ce889d46b34", | ||
"dependencies": { | ||
"@spinajs/di": "^1.2.81" | ||
} | ||
} |
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
13258
266
1
+ Added@spinajs/di@^1.2.81
+ Added@spinajs/di@1.2.211(transitive)
+ Added@spinajs/exceptions@1.2.127(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedreflect-metadata@0.1.14(transitive)