diff --git a/src/egg.ts b/src/egg.ts index 56f66773..dce086b6 100644 --- a/src/egg.ts +++ b/src/egg.ts @@ -20,7 +20,7 @@ import { Lifecycle } from './lifecycle.js'; import { EggLoader } from './loader/egg_loader.js'; import utils from './utils/index.js'; -const debug = debuglog('@eggjs/core:egg'); +const debug = debuglog('@eggjs/core/egg'); export const EGG_LOADER = Symbol.for('egg#loader'); diff --git a/src/loader/egg_loader.ts b/src/loader/egg_loader.ts index 809c316d..2e157eca 100644 --- a/src/loader/egg_loader.ts +++ b/src/loader/egg_loader.ts @@ -135,7 +135,7 @@ export class EggLoader { // eslint-disable-next-line @typescript-eslint/no-var-requires require('tsconfig-paths').register({ cwd: this.options.baseDir }); } else { - this.logger.info('[@eggjs/core:egg_loader] skip register "tsconfig-paths" because tsconfig.json not exists at %s', + this.logger.info('[@eggjs/core/egg_loader] skip register "tsconfig-paths" because tsconfig.json not exists at %s', tsConfigFile); } } @@ -639,14 +639,14 @@ export class EggLoader { const logger = this.options.logger; if (!config) { - logger.warn(`[@eggjs/core:egg_loader] pkg.eggPlugin is missing in ${pluginPackage}`); + logger.warn(`[@eggjs/core/egg_loader] pkg.eggPlugin is missing in ${pluginPackage}`); return; } if (config.name && config.strict !== false && config.name !== plugin.name) { // pluginName is configured in config/plugin.js // pluginConfigName is pkg.eggPlugin.name - logger.warn(`[@eggjs/core:egg_loader] pluginName(${plugin.name}) is different from pluginConfigName(${config.name})`); + logger.warn(`[@eggjs/core/egg_loader] pluginName(${plugin.name}) is different from pluginConfigName(${config.name})`); } // dep compatible @@ -1184,7 +1184,7 @@ export class EggLoader { this.lifecycle.addFunctionAsBootHook(bootHook, bootFilePath); debug('[loadBootHook] add bootHookFunction from %o', bootFilePath); } else { - this.options.logger.warn('[@eggjs/core:egg_loader] %s must exports a boot class', bootFilePath); + this.options.logger.warn('[@eggjs/core/egg_loader] %s must exports a boot class', bootFilePath); } } // init boots @@ -1295,13 +1295,13 @@ export class EggLoader { } app.use(mw); debug('[loadMiddleware] Use middleware: %s with options: %j', name, options); - this.options.logger.info('[@eggjs/core:egg_loader] Use middleware: %s', name); + this.options.logger.info('[@eggjs/core/egg_loader] Use middleware: %s', name); } else { - this.options.logger.info('[@eggjs/core:egg_loader] Disable middleware: %s', name); + this.options.logger.info('[@eggjs/core/egg_loader] Disable middleware: %s', name); } } - this.options.logger.info('[@eggjs/core:egg_loader] Loaded middleware from %j', middlewarePaths); + this.options.logger.info('[@eggjs/core/egg_loader] Loaded middleware from %j', middlewarePaths); this.timing.end('Load Middleware'); // add router middleware, make sure router is the last middleware @@ -1359,7 +1359,7 @@ export class EggLoader { }; await this.loadToApp(controllerBase, 'controller', opt as FileLoaderOptions); debug('[loadController] app.controller => %o', this.app.controller); - this.options.logger.info('[@eggjs/core:egg_loader] Controller loaded: %s', controllerBase); + this.options.logger.info('[@eggjs/core/egg_loader] Controller loaded: %s', controllerBase); this.timing.end('Load Controller'); } /** end Controller loader */ diff --git a/src/utils/index.ts b/src/utils/index.ts index 00664b91..5bca94a6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,7 +5,7 @@ import { stat } from 'node:fs/promises'; import BuiltinModule from 'node:module'; import { importResolve, importModule } from '@eggjs/utils'; -const debug = debuglog('@eggjs/core:utils'); +const debug = debuglog('@eggjs/core/utils'); export type Fun = (...args: any[]) => any; @@ -55,10 +55,10 @@ function getCalleeFromStack(withLine?: boolean, stackIndex?: number) { export default { deprecated(message: string) { if (debug.enabled) { - console.trace('[@eggjs/core:deprecated] %s', message); + console.trace('[@eggjs/core/deprecated] %s', message); } else { - console.warn('[@eggjs/core:deprecated] %s', message); - console.warn('[@eggjs/core:deprecated] set NODE_DEBUG=@eggjs/core:utils can show call stack'); + console.log('[@eggjs/core/deprecated] %s', message); + console.log('[@eggjs/core/deprecated] set NODE_DEBUG=@eggjs/core/utils can show call stack'); } }, diff --git a/src/utils/sequencify.ts b/src/utils/sequencify.ts index d28f8b63..41d39f06 100644 --- a/src/utils/sequencify.ts +++ b/src/utils/sequencify.ts @@ -1,6 +1,6 @@ import { debuglog } from 'node:util'; -const debug = debuglog('@eggjs/core:utils:sequencify'); +const debug = debuglog('@eggjs/core/utils/sequencify'); export interface SequencifyResult { sequence: string[]; diff --git a/src/utils/timing.ts b/src/utils/timing.ts index 5f5be625..cb053ffc 100644 --- a/src/utils/timing.ts +++ b/src/utils/timing.ts @@ -2,7 +2,7 @@ import { EOL } from 'node:os'; import { debuglog } from 'node:util'; import assert from 'node:assert'; -const debug = debuglog('@eggjs/core:utils:timing'); +const debug = debuglog('@eggjs/core/utils/timing'); export interface TimingItem { name: string; diff --git a/test/loader/mixin/load_plugin.test.ts b/test/loader/mixin/load_plugin.test.ts index 493a688c..f411a066 100644 --- a/test/loader/mixin/load_plugin.test.ts +++ b/test/loader/mixin/load_plugin.test.ts @@ -200,7 +200,7 @@ describe('test/loader/mixin/load_plugin.test.ts', () => { let message = ''; app = createApp('plugin'); mm(app.console, 'warn', function(m: string) { - if (!m.startsWith('[@eggjs/core:egg_loader] eggPlugin is missing') && !message) { + if (!m.startsWith('[@eggjs/core/egg_loader] eggPlugin is missing') && !message) { message = m; } }); @@ -208,7 +208,7 @@ describe('test/loader/mixin/load_plugin.test.ts', () => { await loader.loadPlugin(); await loader.loadConfig(); - assert.equal(message, '[@eggjs/core:egg_loader] pluginName(e) is different from pluginConfigName(wrong-name)'); + assert.equal(message, '[@eggjs/core/egg_loader] pluginName(e) is different from pluginConfigName(wrong-name)'); }); it('should not warn when the config.strict is false', async () => { @@ -496,7 +496,7 @@ describe('test/loader/mixin/load_plugin.test.ts', () => { await loader.loadPlugin(); const plugin = loader.plugins.a; assert.equal(plugin.name, 'a'); - assert.equal(plugin.path, getFilepath('realpath/a')); + assert.equal(plugin.path, getFilepath('realpath/node_modules/a')); }); it('should get the defining plugin path in every plugin', async () => {