Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wisko committed Nov 11, 2024
1 parent 2f5e462 commit 3e1e407
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 158 deletions.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { getHttpTraceHeader } from "./lib/http";
export { decorateLogs, logger, Logger, LoggerOptions } from "./lib/logging";
export { decorateLogs, logger, Logger, LoggerOptions, DestinationStream } from "./lib/logging";
export { middleware } from "./lib/middleware";
export { createTraceparent } from "./lib/traceparent";
10 changes: 8 additions & 2 deletions lib/logging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import pino, { DestinationStream, LoggerOptions as PinoOptions, Logger as PinoLogger } from "pino";
import pino, {
DestinationStream as PinoDestinationStream,
LoggerOptions as PinoOptions,
Logger as PinoLogger,
} from "pino";
import { getStore } from "./middleware";

function getLoggingData() {
Expand All @@ -20,12 +24,14 @@ export function decorateLogs(obj: Record<string, unknown>) {
}
}

export type Logger = PinoLogger<never, boolean>;

export type LoggerOptions = Omit<PinoOptions, "level" | "formatters"> & {
logLevel?: "trace" | "debug" | "info" | "warn" | "error" | "fatal";
formatLog?: NonNullable<PinoOptions["formatters"]>["log"];
};

export type Logger = PinoLogger<never, boolean>;
export type DestinationStream = PinoDestinationStream;

export function logger(options: LoggerOptions = {}, stream?: DestinationStream | undefined): Logger {
const env = process.env.NODE_ENV /* c8 ignore next */ || "development";
Expand Down
138 changes: 5 additions & 133 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"gcp-metadata": "^6.1.0",
"pino": "^9.5.0",
"pino-pretty": "^12.1.0"
"pino-pretty": "^13.0.0"
},
"devDependencies": {
"@bonniernews/tsconfig": "^0.0.2",
Expand Down
Loading

0 comments on commit 3e1e407

Please sign in to comment.