mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
do not log debug on production
This commit is contained in:
@@ -6,6 +6,7 @@ const COLORS = {
|
||||
reset: '\x1b[0m',
|
||||
};
|
||||
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const useColor = process.stdout.isTTY || process.stderr.isTTY;
|
||||
|
||||
function ts() {
|
||||
@@ -27,6 +28,10 @@ function lvl(level) {
|
||||
|
||||
/* eslint-disable no-console */
|
||||
function log(level, ...args) {
|
||||
if (level === 'debug' && env !== 'development') {
|
||||
return; // Skip debug logs in non-development environments
|
||||
}
|
||||
|
||||
const prefix = `[${ts()}] ${lvl(level)}:`;
|
||||
switch (level) {
|
||||
case 'debug':
|
||||
|
||||
Reference in New Issue
Block a user