Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Nestjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
Koishi Nestjs
Commits
67e35b39
Commit
67e35b39
authored
Oct 09, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
color
parent
fa70be2f
Pipeline
#6168
passed with stages
in 51 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletion
+8
-1
README.md
README.md
+2
-0
src/koishi-logger.service.ts
src/koishi-logger.service.ts
+5
-1
src/koishi.interfaces.ts
src/koishi.interfaces.ts
+1
-0
No files found.
README.md
View file @
67e35b39
...
...
@@ -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 插件。
...
...
src/koishi-logger.service.ts
View file @
67e35b39
...
...
@@ -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
),
},
];
...
...
src/koishi.interfaces.ts
View file @
67e35b39
...
...
@@ -41,6 +41,7 @@ export interface WhetherGlobalOption {
export
interface
KoishiModuleOptions
extends
App
.
Config
,
WhetherGlobalOption
{
usePlugins
?:
KoishiModulePlugin
<
Plugin
>
[];
loggerPrefix
?:
string
;
loggerColor
?:
number
;
}
export
interface
KoishiModuleOptionsFactory
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment