8d06a6475e
* chore: 著作権とライセンスについての情報を各ファイルに追加する * chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * chore: Add SPDX-License-Identifier [skip ci] * add missing SPDX-License-Identifier * remove unused file --------- Co-authored-by: Shun Sakai <sorairolake@protonmail.ch> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> Co-authored-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { LoggerService } from '@nestjs/common';
|
|
import Logger from '@/logger.js';
|
|
|
|
const logger = new Logger('core', 'cyan');
|
|
const nestLogger = logger.createSubLogger('nest', 'green', false);
|
|
|
|
export class NestLogger implements LoggerService {
|
|
/**
|
|
* Write a 'log' level log.
|
|
*/
|
|
log(message: any, ...optionalParams: any[]) {
|
|
const ctx = optionalParams[0];
|
|
nestLogger.info(ctx + ': ' + message);
|
|
}
|
|
|
|
/**
|
|
* Write an 'error' level log.
|
|
*/
|
|
error(message: any, ...optionalParams: any[]) {
|
|
const ctx = optionalParams[0];
|
|
nestLogger.error(ctx + ': ' + message);
|
|
}
|
|
|
|
/**
|
|
* Write a 'warn' level log.
|
|
*/
|
|
warn(message: any, ...optionalParams: any[]) {
|
|
const ctx = optionalParams[0];
|
|
nestLogger.warn(ctx + ': ' + message);
|
|
}
|
|
|
|
/**
|
|
* Write a 'debug' level log.
|
|
*/
|
|
debug?(message: any, ...optionalParams: any[]) {
|
|
if (process.env.NODE_ENV === 'production') return;
|
|
const ctx = optionalParams[0];
|
|
nestLogger.debug(ctx + ': ' + message);
|
|
}
|
|
|
|
/**
|
|
* Write a 'verbose' level log.
|
|
*/
|
|
verbose?(message: any, ...optionalParams: any[]) {
|
|
if (process.env.NODE_ENV === 'production') return;
|
|
const ctx = optionalParams[0];
|
|
nestLogger.debug(ctx + ': ' + message);
|
|
}
|
|
}
|