summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-17 18:33:32 -0300
committerEuAndreh <eu@euandre.org>2024-03-17 18:33:35 -0300
commit5e656cdb48d47f45dd95bf8c52060a48b912e79d (patch)
tree6b240d31b28db40116541b8fd8c642753a63219a
parenttests/js/hero.mjs: Add simple test for now() (diff)
downloadpapod-5e656cdb48d47f45dd95bf8c52060a48b912e79d.tar.gz
papod-5e656cdb48d47f45dd95bf8c52060a48b912e79d.tar.xz
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*.
-rw-r--r--src/hero.mjs2
-rw-r--r--tests/lighttpd.conf6
2 files changed, 4 insertions, 4 deletions
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 ?
diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf
index 21f8011..e3cdce0 100644
--- a/tests/lighttpd.conf
+++ b/tests/lighttpd.conf
@@ -6,9 +6,9 @@ server.modules += (
server.bind = var.CWD + "/lighttpd.socket"
server.document-root = var.CWD + "/src/static/"
-server.errorlog = "/dev/stderr"
-server.breakagelog = "/dev/stderr"
-accesslog.filename = "/dev/stderr"
+server.errorlog = "/dev/stdout"
+server.breakagelog = "/dev/stdout"
+accesslog.filename = "/dev/stdout"
accesslog.format = ""
accesslog.format += "{ "