ConsoleLogAppender logs TRACE messages with console.log

console.trace generates and prints a full stacktrace for every log
message. This is not what TRACE means in this library. The TRACE level
is intended for logs that are more verbose than you typically want to
log and should only be turned on when you are trying to trace the
detailed behavior of the logged functionality. Printing the full stack
trace with every message makes an already verbose setting exponentially
worse.
This commit is contained in:
2026-01-09 19:23:38 -06:00
parent 642078e728
commit 895a8c42ca
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@jdbernard/logging", "name": "@jdbernard/logging",
"version": "2.3.2", "version": "2.3.3",
"description": "Simple Javascript logging service.", "description": "Simple Javascript logging service.",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
+4 -2
View File
@@ -39,9 +39,11 @@ export class ConsoleLogAppender implements LogAppender {
switch (msg.level) { switch (msg.level) {
case LogLevel.ALL: case LogLevel.ALL:
case LogLevel.TRACE: case LogLevel.TRACE:
logMethod = console.trace
break
case LogLevel.LOG: case LogLevel.LOG:
// console.trace generates and prints a stack trace attached to the
// logged message. This is not really what we want for TRACE level
// messages as it just makes things more verbose needlessly, so these
// all log to console.log
logMethod = console.log logMethod = console.log
break break
case LogLevel.DEBUG: case LogLevel.DEBUG: