mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
merge: Add MK_HIDE_WORKER_ID to exclude worker ID from logs (!1063)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1063 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
48f3910036
2 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@ const envOption = {
|
||||||
verbose: false,
|
verbose: false,
|
||||||
withLogTime: false,
|
withLogTime: false,
|
||||||
quiet: false,
|
quiet: false,
|
||||||
|
hideWorkerId: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const key of Object.keys(envOption) as (keyof typeof envOption)[]) {
|
for (const key of Object.keys(envOption) as (keyof typeof envOption)[]) {
|
||||||
|
|
|
@ -71,7 +71,9 @@ export default class Logger {
|
||||||
level === 'info' ? message :
|
level === 'info' ? message :
|
||||||
null;
|
null;
|
||||||
|
|
||||||
let log = `${l} ${worker}\t[${contexts.join(' ')}]\t${m}`;
|
let log = envOption.hideWorkerId
|
||||||
|
? `${l}\t[${contexts.join(' ')}]\t${m}`
|
||||||
|
: `${l} ${worker}\t[${contexts.join(' ')}]\t${m}`;
|
||||||
if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log;
|
if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log;
|
||||||
|
|
||||||
const args: unknown[] = [important ? chalk.bold(log) : log];
|
const args: unknown[] = [important ? chalk.bold(log) : log];
|
||||||
|
|
Loading…
Add table
Reference in a new issue