eventregistry
Advanced tools
Comparing version 9.1.0 to 9.1.1
@@ -21,5 +21,5 @@ export declare enum LogLevel { | ||
private customLevels; | ||
private readonly _errorLog; | ||
private readonly _infoLog; | ||
private readonly _requestLog; | ||
private _errorLog; | ||
private _infoLog; | ||
private _requestLog; | ||
constructor({ logging, logRequests }: LoggerConfig); | ||
@@ -44,3 +44,4 @@ static createInstance({ logging, logRequests }: LoggerConfig): Logger; | ||
logRequest(message: string): void; | ||
private createFileTransports; | ||
} | ||
export {}; |
@@ -36,14 +36,2 @@ "use strict"; | ||
}; | ||
this._errorLog = new winston.transports.File({ | ||
filename: "logs/error.log", | ||
level: "error", | ||
}); | ||
this._infoLog = new winston.transports.File({ | ||
filename: "logs/info.log", | ||
level: "info", | ||
}); | ||
this._requestLog = new winston.transports.File({ | ||
filename: "logs/requests.log", | ||
level: "request", | ||
}); | ||
this._transports = [ | ||
@@ -53,2 +41,3 @@ new winston.transports.Console() | ||
if (logging) { | ||
this.createFileTransports(); | ||
this._transports.push(this._errorLog); | ||
@@ -95,8 +84,11 @@ this._transports.push(this._infoLog); | ||
Logger.prototype.enableRequestLogging = function () { | ||
this.createFileTransports(); | ||
this._logger.add(this._requestLog); | ||
}; | ||
Logger.prototype.disableRequestLogging = function () { | ||
this.createFileTransports(); | ||
this._logger.remove(this._requestLog); | ||
}; | ||
Logger.prototype.enableLogging = function () { | ||
this.createFileTransports(); | ||
this._logger.add(this._errorLog); | ||
@@ -106,2 +98,3 @@ this._logger.add(this._infoLog); | ||
Logger.prototype.disableLogging = function () { | ||
this.createFileTransports(); | ||
this._logger.remove(this._errorLog); | ||
@@ -145,2 +138,21 @@ this._logger.remove(this._infoLog); | ||
}; | ||
Logger.prototype.createFileTransports = function () { | ||
if (this._errorLog && this._infoLog && this._requestLog) | ||
return; | ||
this._errorLog = new winston.transports.File({ | ||
filename: "logs/error.log", | ||
level: "error", | ||
lazy: true, | ||
}); | ||
this._infoLog = new winston.transports.File({ | ||
filename: "logs/info.log", | ||
level: "info", | ||
lazy: true, | ||
}); | ||
this._requestLog = new winston.transports.File({ | ||
filename: "logs/requests.log", | ||
level: "request", | ||
lazy: true, | ||
}); | ||
}; | ||
return Logger; | ||
@@ -147,0 +159,0 @@ }()); |
@@ -5,3 +5,3 @@ { | ||
"description": "Package containing wrapper functions for Event Registry API", | ||
"version": "9.1.0", | ||
"version": "9.1.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "./dist/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
748454
11807