Commit 5633a039 authored by nanahira's avatar nanahira

improve

parent 09535e3e
Pipeline #6106 failed with stages
in 30 seconds
{
"name": "koishi-nestjs",
"version": "1.0.16",
"version": "1.0.18",
"description": "Koishi.js as Nest.js Module",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
......
import {
ConsoleLogger,
Inject,
Injectable,
OnModuleInit,
} from '@nestjs/common';
import { ConsoleLogger, Inject, Injectable } from '@nestjs/common';
import { Logger } from 'koishi';
import { KOISHI_MODULE_OPTIONS } from './koishi.constants';
import { KoishiModuleOptions } from './koishi.interfaces';
......@@ -17,29 +12,31 @@ export class KoishiLoggerService extends ConsoleLogger {
Logger.targets = [
{
colors: 3,
print(text: string) {
const header = text.slice(0, 4);
const body = text.slice(4);
switch (header) {
case '[S] ':
case '[I] ':
_this.log(body);
break;
case '[W] ':
_this.warn(body);
break;
case '[E] ':
_this.error(body);
break;
case '[D] ':
_this.debug(body);
break;
default:
_this.log(text);
break;
}
},
print: (text: string) => this.printKoishiLog(text),
},
];
}
private printKoishiLog(text: string) {
const header = text.slice(0, 4);
const body = text.slice(4);
switch (header) {
case '[S] ':
case '[I] ':
this.log(body);
break;
case '[W] ':
this.warn(body);
break;
case '[E] ':
this.error(body);
break;
case '[D] ':
this.debug(body);
break;
default:
this.log(text);
break;
}
}
}
import { App, Logger } from 'koishi';
import { App } from 'koishi';
import {
ConsoleLogger,
Inject,
......
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