refactor(logging): separate console and debug logger classes
- Preserve TraceLogger console formatting and add DebugLogger with DEBUG namespace output. - Select the logger through LOG_MODE and route application call sites through the factory. - Cover factory selection, console formatting, debug output and auth-log redaction.
This commit is contained in:
1 parent
ceed27ad9e
commit
7235abdcef
16 files changed
+146
-142
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { CallHandler, ExecutionContext } from "@nestjs/common";
|
||||
import { of } from "rxjs";
|
||||
import { TraceLogger } from "../src/common/trace-logger";
|
||||
import { DebugLogger } from "../src/common/debug-logger";
|
||||
import {
|
||||
LoggingInterceptor,
|
||||
redactAuthRequestBody,
|
||||
@@ -31,7 +31,7 @@ describe("redactAuthRequestBody", () => {
|
||||
it("never logs a password received on the accepted trailing-slash login path", () => {
|
||||
const loggedMessages: unknown[][] = [];
|
||||
const debug = jest
|
||||
.spyOn(TraceLogger.prototype, "debug")
|
||||
.spyOn(DebugLogger.prototype, "debug")
|
||||
.mockImplementation((...args: unknown[]) => {
|
||||
loggedMessages.push(args);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user