persona-community-5/.pnpm-store/v3/files/8c/690b79f8e44ca3bb7f69ac62666907982ab8014b5e54e6f5e06736ecc3791785bc40063af49fb598f48f6d51f603a29c6083548508cb5d57f38664551ab8cd
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

37 lines
910 B
Plaintext

import * as colorette from 'colorette';
import { isBrowser } from './env';
import { identity } from './utils';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore this works but some types are not working
export const colorOptions = colorette.options;
export const colorize = new Proxy(colorette, {
get(target: typeof colorette, prop: string): typeof identity {
if (isBrowser) {
return identity;
}
return (target as any)[prop];
},
});
class Logger {
protected stderr(str: string) {
return process.stderr.write(str);
}
info(str: string) {
return isBrowser ? console.log(str) : this.stderr(str);
}
warn(str: string) {
return isBrowser ? console.warn(str) : this.stderr(colorize.yellow(str));
}
error(str: string) {
return isBrowser ? console.error(str) : this.stderr(colorize.red(str));
}
}
export const logger = new Logger();