summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/LoggerService.ts
blob: 25721f0630c9beefe2205149ab1d232e7d49916f (plain)
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
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import { Inject, Injectable } from '@nestjs/common';
import Logger from '@/logger.js';
import { bindThis } from '@/decorators.js';
import type { KEYWORD } from 'color-convert/conversions.js';
import { envOption } from '@/env.js';
import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';

@Injectable()
export class LoggerService {
	constructor(
		@Inject(DI.config)
		private config: Config,
	) {
	}

	@bindThis
	public getLogger(domain: string, color?: KEYWORD | undefined) {
		const verbose = this.config.logging?.verbose || envOption.verbose;
		return new Logger(domain, color, verbose);
	}
}