Skip to content

Commit

Permalink
Revert "Merge pull request #333 from Blobscan/chore/log-level-paramet…
Browse files Browse the repository at this point in the history
…rization-fix"

This reverts commit 3bdff29, reversing
changes made to 4e0fb76.
  • Loading branch information
PJColombo committed Mar 14, 2024
1 parent 3bdff29 commit ab4b2d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 0 additions & 5 deletions .changeset/olive-coats-smile.md

This file was deleted.

11 changes: 7 additions & 4 deletions packages/logger/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { booleanSchema, createEnv, presetEnvOptions, z } from "@blobscan/zod";
import {
booleanSchema,
createEnv,
nodeEnvSchema,
presetEnvOptions,
} from "@blobscan/zod";

export const env = createEnv({
envOptions: {
server: {
LOGGER_LEVEL: z
.enum(["error", "warn", "info", "http", "debug"])
.default("info"),
NODE_ENV: nodeEnvSchema.optional(),
TEST: booleanSchema.optional(),
},

Expand Down
6 changes: 5 additions & 1 deletion packages/logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const colors = {
debug: "white",
};

const level = () => {
return env.NODE_ENV === "production" ? "info" : "debug";
};

const format = winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss:ms" }),
winston.format.colorize({ all: true }),
Expand All @@ -21,7 +25,7 @@ const format = winston.format.combine(
winston.addColors(colors);

export const logger = winston.createLogger({
level: env.LOGGER_LEVEL,
level: level(),
format,
transports: [new winston.transports.Console()],
silent: env.TEST,
Expand Down

0 comments on commit ab4b2d2

Please sign in to comment.