19 lines
612 B
JavaScript
19 lines
612 B
JavaScript
// Schlanker, konsistenter Logger. Alle Ausgaben mit Zeitstempel + [fsvc]-Präfix,
|
|
// damit man im Container-Log Fileservice-Zeilen sofort erkennt.
|
|
// Im Test (NODE_ENV=test) still, damit die Jest-Ausgabe sauber bleibt.
|
|
const silent = process.env.NODE_ENV === 'test';
|
|
|
|
const ts = () => new Date().toISOString();
|
|
|
|
function info(...args) {
|
|
if (!silent) console.log(`${ts()} [fsvc]`, ...args);
|
|
}
|
|
function warn(...args) {
|
|
if (!silent) console.warn(`${ts()} [fsvc] ⚠`, ...args);
|
|
}
|
|
function error(...args) {
|
|
if (!silent) console.error(`${ts()} [fsvc] ✖`, ...args);
|
|
}
|
|
|
|
module.exports = { info, warn, error };
|