mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 10:23:14 +00:00
fix: only log warnings and errors in prod (#618)
This commit is contained in:
parent
2da1aa95ee
commit
ba0ab56f4b
1 changed files with 8 additions and 2 deletions
|
|
@ -81,14 +81,20 @@ export function createLogger(level: LogLevel, prefix: string) {
|
|||
? `[${prefix}]`
|
||||
: `${BOLD}${color}[${prefix}]${RESET}`;
|
||||
|
||||
// In production, only allow warn and error logs
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
|
||||
return {
|
||||
debug: (message: string, data?: any) => {
|
||||
if (level === LogLevel.DEBUG) {
|
||||
if (!isProduction && level === LogLevel.DEBUG) {
|
||||
logWithOptionalIds(styledPrefix, message, data);
|
||||
}
|
||||
},
|
||||
info: (message: string, data?: any) => {
|
||||
if (level === LogLevel.INFO || level === LogLevel.DEBUG) {
|
||||
if (
|
||||
!isProduction &&
|
||||
(level === LogLevel.INFO || level === LogLevel.DEBUG)
|
||||
) {
|
||||
logWithOptionalIds(styledPrefix, message, data);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue