Skip to content

Commit

Permalink
refa: rename _prolog to prologue
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 23, 2022
1 parent 09d093a commit 26efdd2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/addons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Watcher from './watcher'

declare module 'koishi' {
interface App {
_prolog: string[]
prologue: string[]
watcher: Watcher
}

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/addons/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ App.Config.list.push(Schema.object({
logger: Config,
}))

let prolog: string[] = []
let prologue: string[] = []

const target: Logger.Target = {
colors: 3,
showTime: 'yyyy-MM-dd hh:mm:ss',
print: text => prolog.push(text),
print: text => prologue.push(text),
}

export function prepare(config: Config = {}) {
Expand Down Expand Up @@ -77,7 +77,7 @@ export function prepare(config: Config = {}) {
}

export function apply(app: App) {
app._prolog = prolog
app.prologue = prologue
app.on('ready', () => {
remove(Logger.targets, target)
})
Expand Down
6 changes: 3 additions & 3 deletions plugins/frontend/logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class LogProvider extends DataSource<string[]> {
}

prepareLogger() {
if (this.ctx.app._prolog) {
for (const line of this.ctx.app._prolog) {
if (this.ctx.app.prologue) {
for (const line of this.ctx.app.prologue) {
this.printText(line)
}
this.ctx.app._prolog = null
this.ctx.app.prologue = null
}

const target: Logger.Target = {
Expand Down

0 comments on commit 26efdd2

Please sign in to comment.