From 5e656cdb48d47f45dd95bf8c52060a48b912e79d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 17 Mar 2024 18:33:32 -0300 Subject: src/hero.mjs: Log to stdout instead of stderr The first question that this brings is: Is the output of the program useful for a downstream process? Is this logging an *output* of the program? But in this case, the answer is: yes, for both questions. A downstream program could very well be fed the output of the program via a pipe and process it, as the data being emitted is meant to be ingested. So instead of following the default "warnings ought to go to stderr" model, we acknowledge that the data is actually an *out*put, and send it to std*out*. --- src/hero.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/hero.mjs') diff --git a/src/hero.mjs b/src/hero.mjs index d97f028..c36da68 100644 --- a/src/hero.mjs +++ b/src/hero.mjs @@ -32,7 +32,7 @@ export const logit = (writerFn, timestampFn, level, o) => export const now = () => (new Date()).toISOString(); export const makeLogger = ({ - writerFn = console.error, + writerFn = console.log, timestampFn = now, } = {}) => ({ debug: (...args) => process.env.DEBUG ? -- cgit v1.2.3