openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
7 lines • 1.9 kB
JavaScript
import{d as defaultRuntime,f as isVerbose,i as getLogger,n as writeRootConsoleLine,t as createSubsystemLogger}from"./subsystem-BMw5Czn-.mjs";import chalk,{Chalk}from"chalk";
//!packages/terminal-core/src/palette.ts
const LOBSTER_PALETTE={accent:`#FF5A2D`,accentBright:`#FF7A3D`,accentDim:`#D14A22`,info:`#FF8A5B`,success:`#2FBF71`,warn:`#FFB020`,error:`#E23D2D`,muted:`#8B7F77`};
//!packages/terminal-core/src/theme.ts
const hasForceColor=typeof process.env.FORCE_COLOR===`string`&&process.env.FORCE_COLOR.trim().length>0&&process.env.FORCE_COLOR.trim()!==`0`;const baseChalk=process.env.NO_COLOR&&!hasForceColor?new Chalk({level:0}):chalk;const hex=e=>baseChalk.hex(e);const theme={accent:hex(LOBSTER_PALETTE.accent),accentBright:hex(LOBSTER_PALETTE.accentBright),accentDim:hex(LOBSTER_PALETTE.accentDim),info:hex(LOBSTER_PALETTE.info),success:hex(LOBSTER_PALETTE.success),warn:hex(LOBSTER_PALETTE.warn),error:hex(LOBSTER_PALETTE.error),muted:hex(LOBSTER_PALETTE.muted),heading:baseChalk.bold.hex(LOBSTER_PALETTE.accent),command:hex(LOBSTER_PALETTE.accentBright),option:hex(LOBSTER_PALETTE.warn)};
//!src/logger.ts
const subsystemPrefixRe=/^([a-z][a-z0-9-]{1,20}):\s+(.*)$/i;function splitSubsystem(e){const t=e.match(subsystemPrefixRe);if(!t)return null;const n=t.at(1);const r=t.at(2);if(n===void 0||r===void 0)return null;return{subsystem:n,rest:r}}function logWithSubsystem(e,t,n){const r=n===defaultRuntime?splitSubsystem(t):null;if(r){createSubsystemLogger(r.subsystem)[e](r.rest);return}const i=e===`error`?`error`:`log`;const a=theme[e](t);if(n!==defaultRuntime||!writeRootConsoleLine(i,a))n[i](a);getLogger()[e](t)}function logWarn(e,t=defaultRuntime){logWithSubsystem(`warn`,e,t)}function logError(e,t=defaultRuntime){logWithSubsystem(`error`,e,t)}function logDebug(e){getLogger().debug(e);if(isVerbose())console.log(theme.muted(e))}export{theme as i,logError as n,logWarn as r,logDebug as t};