@compas/insight
Advanced tools
Comparing version 0.0.106 to 0.0.107
{ | ||
"name": "@compas/insight", | ||
"version": "0.0.106", | ||
"version": "0.0.107", | ||
"description": "Simple logger in NDJSON format", | ||
@@ -35,3 +35,3 @@ "main": "./index.js", | ||
}, | ||
"gitHead": "c567f9d3f31a2e19a7cc88f0ea4d19a4e290b597" | ||
"gitHead": "3788c6771ecb63aa83528f821c0572b22b524d3d" | ||
} |
@@ -108,3 +108,3 @@ # @compas/insight | ||
For contributing see [contributing.md](https://compasjs.com/contributing). | ||
For contributing see [contributing.md](https://compasjs.com/contributing.html). | ||
@@ -111,0 +111,0 @@ ## New features |
@@ -26,10 +26,13 @@ import { inspect } from "util"; | ||
export function writePretty(stream, level, timestamp, context, message) { | ||
stream.write( | ||
`${formatDate(timestamp)} ${formatLevelAndType(level, context?.type)}`, | ||
); | ||
let prefix = `${formatDate(timestamp)} ${formatLevelAndType( | ||
level, | ||
context?.type, | ||
)}`; | ||
if (message) { | ||
stream.write(" "); | ||
prefix += " "; | ||
if (Array.isArray(message)) { | ||
stream.write(message.map((it) => formatMessagePretty(it)).join(", ")); | ||
stream.write( | ||
`${prefix + message.map((it) => formatMessagePretty(it)).join(", ")}\n`, | ||
); | ||
} else { | ||
@@ -43,9 +46,7 @@ let keyCount = 0; | ||
if (Object.keys(context).length > keyCount) { | ||
stream.write(`${formatMessagePretty(context)} `); | ||
prefix += `${formatMessagePretty(context)} `; | ||
} | ||
stream.write(formatMessagePretty(message)); | ||
stream.write(`${prefix + formatMessagePretty(message)}\n`); | ||
} | ||
} | ||
stream.write("\n"); | ||
} | ||
@@ -52,0 +53,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18174
482