Commit 67e35b39 authored by nanahira's avatar nanahira

color

parent fa70be2f
Pipeline #6168 passed with stages
in 51 seconds
......@@ -77,6 +77,8 @@ Koishi-Nest 的配置项和 Koishi 配置项一致,参照 [Koishi 文档](http
* `loggerPrefix`: `string` Nest 日志中 Logger 的前缀。默认 `koishi`
* `loggerColor`: `number` Nest 日志中 Logger 的颜色支持。默认 `2`
* `usePlugins`: `KoishiModulePlugin[]` 可选。预先安装的 Koishi 插件列表。使用 `PluginDef(plugin, options, select)` 方法生成该项的定义。该配置项的成员参数如下。
* `plugin` Koishi 插件。
......
......@@ -7,9 +7,13 @@ import { KoishiModuleOptions } from './koishi.interfaces';
export class KoishiLoggerService extends ConsoleLogger {
constructor(@Inject(KOISHI_MODULE_OPTIONS) options: KoishiModuleOptions) {
super(options.loggerPrefix || 'koishi');
let colors = options.loggerColor;
if (colors == null) {
colors = 2;
}
Logger.targets = [
{
colors: 3,
colors,
print: (text: string) => this.printKoishiLog(text),
},
];
......
......@@ -41,6 +41,7 @@ export interface WhetherGlobalOption {
export interface KoishiModuleOptions extends App.Config, WhetherGlobalOption {
usePlugins?: KoishiModulePlugin<Plugin>[];
loggerPrefix?: string;
loggerColor?: number;
}
export interface KoishiModuleOptionsFactory {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment