mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-06 21:42:13 +00:00
[open-swe] feat: disable ANSI colors in logger for production environment (#374)
* Apply patch * Apply patch --------- Co-authored-by: open-swe-dev[bot] <open-swe-dev@users.noreply.github.com> Co-authored-by: Brace Sproul <braceasproul@gmail.com>
This commit is contained in:
parent
4fb0f90f4e
commit
a03805c704
1 changed files with 6 additions and 1 deletions
|
|
@ -74,7 +74,12 @@ function logWithOptionalIds(styledPrefix: string, message: string, data?: any) {
|
||||||
export function createLogger(level: LogLevel, prefix: string) {
|
export function createLogger(level: LogLevel, prefix: string) {
|
||||||
const hash = simpleHash(prefix);
|
const hash = simpleHash(prefix);
|
||||||
const color = COLORS[hash % COLORS.length];
|
const color = COLORS[hash % COLORS.length];
|
||||||
const styledPrefix = `${BOLD}${color}[${prefix}]${RESET}`; // Apply bold and color
|
|
||||||
|
// Use plain prefix in production, styled prefix otherwise
|
||||||
|
const styledPrefix =
|
||||||
|
process.env.NODE_ENV === "production"
|
||||||
|
? `[${prefix}]`
|
||||||
|
: `${BOLD}${color}[${prefix}]${RESET}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
debug: (message: string, data?: any) => {
|
debug: (message: string, data?: any) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue