Skip to content

Commit

Permalink
fix(core-logger-pino): show log levels <= defined threshold level (#3681
Browse files Browse the repository at this point in the history
)
  • Loading branch information
air1one authored May 5, 2020
1 parent 8434157 commit e1921ba
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/e2e/lib/config/nodes/core0/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true
CORE_LOG_LEVEL=emergency
CORE_LOG_LEVEL=debug
CORE_LOG_LEVEL_FILE=trace

CORE_DB_PORT=5432
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/lib/config/nodes/core1/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true
CORE_LOG_LEVEL=emergency
CORE_LOG_LEVEL=debug
CORE_LOG_LEVEL_FILE=trace

CORE_DB_PORT=5432
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/lib/config/nodes/core2/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true
CORE_LOG_LEVEL=emergency
CORE_LOG_LEVEL=debug
CORE_LOG_LEVEL_FILE=trace

CORE_DB_PORT=5432
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/lib/config/nodes/core3/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true
CORE_LOG_LEVEL=emergency
CORE_LOG_LEVEL=debug
CORE_LOG_LEVEL_FILE=trace

CORE_DB_PORT=5432
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/lib/config/nodes/core4/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true
CORE_LOG_LEVEL=emergency
CORE_LOG_LEVEL=debug
CORE_LOG_LEVEL_FILE=trace

CORE_DB_PORT=5432
Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/core-logger-pino/driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ beforeEach(async () => {

logger = await app.resolve<Logger>(PinoLogger).make({
levels: {
console: process.env.CORE_LOG_LEVEL || "emergency",
file: process.env.CORE_LOG_LEVEL_FILE || "emergency",
console: process.env.CORE_LOG_LEVEL || "debug",
file: process.env.CORE_LOG_LEVEL_FILE || "debug",
},
fileRotator: {
interval: "1d",
Expand Down
4 changes: 2 additions & 2 deletions packages/core-logger-pino/src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const defaults = {
levels: {
console: process.env.CORE_LOG_LEVEL || "emergency",
file: process.env.CORE_LOG_LEVEL_FILE || "emergency",
console: process.env.CORE_LOG_LEVEL || "info",
file: process.env.CORE_LOG_LEVEL_FILE || "info",
},
fileRotator: {
interval: "1d",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-logger-pino/src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class PinoLogger implements Contracts.Kernel.Logger {
try {
const json = JSON.parse(chunk);

if (getLevel(json.level) >= getLevel(level)) {
if (getLevel(json.level) <= getLevel(level)) {
const line: string | undefined = pinoPretty(json);

if (line !== undefined) {
Expand Down

0 comments on commit e1921ba

Please sign in to comment.