mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Before this patch, when Authelia started, if Mongo was not up and running, Authelia failed to connect and never retried. Now, everytime Authelia faces a broken connection, it tries to reconnect during the next operation.
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import Sinon = require("sinon");
|
|
import { GlobalLogger } from "./GlobalLogger";
|
|
import Winston = require("winston");
|
|
import Express = require("express");
|
|
import { IGlobalLogger } from "./IGlobalLogger";
|
|
|
|
export class GlobalLoggerStub implements IGlobalLogger {
|
|
infoStub: Sinon.SinonStub;
|
|
debugStub: Sinon.SinonStub;
|
|
errorStub: Sinon.SinonStub;
|
|
private globalLogger: IGlobalLogger;
|
|
|
|
constructor(enableLogging?: boolean) {
|
|
this.infoStub = Sinon.stub();
|
|
this.debugStub = Sinon.stub();
|
|
this.errorStub = Sinon.stub();
|
|
if (enableLogging)
|
|
this.globalLogger = new GlobalLogger(Winston);
|
|
}
|
|
|
|
info(message: string, ...args: any[]): void {
|
|
if (this.globalLogger)
|
|
this.globalLogger.info(message, ...args);
|
|
this.infoStub(message, ...args);
|
|
}
|
|
|
|
debug(message: string, ...args: any[]): void {
|
|
if (this.globalLogger)
|
|
this.globalLogger.info(message, ...args);
|
|
this.debugStub(message, ...args);
|
|
}
|
|
|
|
error(message: string, ...args: any[]): void {
|
|
if (this.globalLogger)
|
|
this.globalLogger.info(message, ...args);
|
|
this.errorStub(message, ...args);
|
|
}
|
|
} |