-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathlog.ts
More file actions
40 lines (34 loc) · 1.2 KB
/
log.ts
File metadata and controls
40 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Command } from '@contentstack/cli-command';
import { cliux, configHandler, TableHeader } from '@contentstack/cli-utilities';
import { getEffectiveLogConfig } from '../../../utils/log-config-defaults';
export default class LogGetCommand extends Command {
static description = 'Get logging configuration for CLI';
static examples = ['csdx config:get:log'];
async run() {
try {
const currentLoggingConfig = configHandler.get('log') || {};
const effectiveConfig = getEffectiveLogConfig(currentLoggingConfig);
const logConfigList = [
{
Setting: 'Log Level',
Value: effectiveConfig.level,
},
{
Setting: 'Log Path',
Value: effectiveConfig.path,
},
{
Setting: 'Show Console Logs',
Value: effectiveConfig.showConsoleLogs.toString(),
},
];
const headers: TableHeader[] = [{ value: 'Setting' }, { value: 'Value' }];
cliux.table(headers, logConfigList);
cliux.print('\nNote: Absolute paths are displayed. Relative paths are resolved from current working directory.', {
color: 'dim',
});
} catch (error) {
cliux.error('error', error);
}
}
}