From 724fe38dfc7e6fd15440a0965cfe1c9999437af2 Mon Sep 17 00:00:00 2001 From: Marais Rossouw Date: Thu, 4 Nov 2021 09:32:47 +1000 Subject: [PATCH] chore: treeshake out the log level strings --- package.json | 2 +- src/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 22120b7..1e5cfe4 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "scripts": { "bench": "cross-env DEBUG=standard ROARR_LOG=true node -r tsm bench/index.ts", "build": "node bin/build && tsc --emitDeclarationOnly", - "fmt": "prettier --write --list-different \"{*,bench/**/*,.github/**/*,test/*}.+(ts|json|yml|md)\"", + "format": "prettier --write --list-different \"{*,bench/**/*,.github/**/*,test/*}.+(ts|json|yml|md)\"", "test": "uvu test \".spec.ts$\" -r tsm -r test/setup.js", "typecheck": "tsc --noEmit" }, diff --git a/src/index.ts b/src/index.ts index ea47bed..67c87be 100644 --- a/src/index.ts +++ b/src/index.ts @@ -95,7 +95,7 @@ function logger( // ~ Reporter -const loglevel_strings: Record = { +const loglevel_strings: Record = /*#__PURE__*/ { fatal: '✗ fatal', error: '✗ error', warn: '‼ warn ', @@ -106,7 +106,7 @@ const loglevel_strings: Record = { const default_reporter: Reporter = (event) => { let label = ''; - if (__TARGET__ === 'node' || __TARGET__ === 'worker') label = `${loglevel_strings[event.level]} `; + if (__TARGET__ === 'node') label = `${loglevel_strings[event.level]} `; if (event.name) label += `[${event.name}] `; console[event.level === 'fatal' ? 'error' : event.level](label + event.message, ...event.extra);