Skip to content

Commit 86376bd

Browse files
committed
fix: identify which config is loaded
1 parent 4b01a44 commit 86376bd

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/bin/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
/* eslint-disable no-console */
23

34
import {
45
createLogFilter,
@@ -60,7 +61,6 @@ const argv = yargs
6061
type: 'string',
6162
},
6263
omit: {
63-
default: [] as readonly string[],
6464
description:
6565
'Omit properties from the Roarr message, e.g. --omit context.version',
6666
type: 'array',
@@ -105,6 +105,8 @@ let filterFunction: FilterFunction | null = null;
105105
let omitPaths: readonly string[] = [];
106106

107107
if (roarrConfigurationPath) {
108+
console.log('[@roarr/cli] loading %s configuration', roarrConfigurationPath);
109+
108110
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
109111
const roarrConfiguration: RoarrConfiguration = require(roarrConfigurationPath);
110112

@@ -171,7 +173,7 @@ stream = stream.pipe(
171173
createLogFormatter({
172174
chalk,
173175
includeDate: argv['include-date'],
174-
omit: argv['omit'] ?? omitPaths,
176+
omitPaths: argv['omit'] ? (argv['omit'] as readonly string[]) : omitPaths,
175177
outputFormat: argv['output-format'],
176178
useColors: argv['use-colors'],
177179
}),

src/factories/createLogFormatter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import split from 'split2';
1212
export const createLogFormatter = (configuration: {
1313
readonly chalk: Chalk;
1414
readonly includeDate: boolean;
15-
readonly omit: readonly string[];
15+
readonly omitPaths: readonly string[];
1616
readonly outputFormat: 'json' | 'pretty';
1717
readonly useColors: boolean;
1818
}) => {
19-
const { chalk, includeDate, useColors, omit } = configuration;
19+
const { chalk, includeDate, useColors, omitPaths } = configuration;
2020

2121
let lastMessageTime: number;
2222

@@ -41,8 +41,8 @@ export const createLogFormatter = (configuration: {
4141
);
4242
}
4343

44-
for (const path of omit) {
45-
dotProp.delete(parsedMessage, path);
44+
for (const omitPath of omitPaths) {
45+
dotProp.delete(parsedMessage, omitPath);
4646
}
4747

4848
const formattedMessage = formatMessage(parsedMessage, {

0 commit comments

Comments
 (0)