Skip to content

Commit

Permalink
chore: treeshake out the log level strings
Browse files Browse the repository at this point in the history
  • Loading branch information
maraisr committed Nov 3, 2021
1 parent 6919b29 commit 724fe38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function logger(

// ~ Reporter

const loglevel_strings: Record<LogLevels, string> = {
const loglevel_strings: Record<LogLevels, string> = /*#__PURE__*/ {
fatal: '✗ fatal',
error: '✗ error',
warn: '‼ warn ',
Expand All @@ -106,7 +106,7 @@ const loglevel_strings: Record<LogLevels, string> = {

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);
Expand Down

0 comments on commit 724fe38

Please sign in to comment.