aop_logger
v1.0.3
Published
auxiliar logger helper that works with aop pattern to perform logs with the logger package of your choose
Downloads
8
Maintainers
Readme
Index
Version changes
- 1.0.2 updated dependencies
- 1.0.1 _logMethod retrieves any, no promise
- 1.0.0 Initial release
Example
class loggerWorker extends AopLogWorker {
public logLevel: eLogLevel, message?: string): void
console.log(logLevel, this._startDate, this._endDate, this._methodName, this._arguments, this._exception, this._ret, message);
}
}
class Whatever extends AopLogger<loggerWorker> {
constructor(...) {
Super(loggerWorker, Whatever.name);
...
}
public methodSomething(...): ... {
return this._logMethod(this.methodSomething.name, arguments, { okLog: eLogLevel.info, koLog: eLogLevel.error, okMessage: 'ok', koMessage: 'ko' }, () => {
...
});
}
public async methodSomething2(...): Promise<...> {
return this._logPromise(this.methodSomething2.name, arguments, { okLog: eLogLevel.info, koLog: eLogLevel.error, okMessage: 'ok', koMessage: 'ko' }, new Promise(
...
));
}
}