mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: use cordis builtin logger
This commit is contained in:
1 parent
a7c14c5a49
commit
d3334666ec
2 files changed
+6
-16
No files matched your search
@@ -17,7 +17,6 @@
|
|||||||
"@aws-sdk/s3-presigned-post": "3.1048.0",
|
"@aws-sdk/s3-presigned-post": "3.1048.0",
|
||||||
"@aws-sdk/s3-request-presigner": "3.1048.0",
|
"@aws-sdk/s3-request-presigner": "3.1048.0",
|
||||||
"@babel/code-frame": "^8.0.0",
|
"@babel/code-frame": "^8.0.0",
|
||||||
"@cordisjs/plugin-logger": "^1.0.2",
|
|
||||||
"@cordisjs/plugin-timer": "1.1.2",
|
"@cordisjs/plugin-timer": "1.1.2",
|
||||||
"@hydrooj/common": "workspace:^",
|
"@hydrooj/common": "workspace:^",
|
||||||
"@hydrooj/framework": "workspace:^",
|
"@hydrooj/framework": "workspace:^",
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { sleep, unwrapExports } from './utils';
|
|||||||
import { PRIV } from './model/builtin';
|
import { PRIV } from './model/builtin';
|
||||||
import { getAddons } from './options';
|
import { getAddons } from './options';
|
||||||
import { TimerService } from '@cordisjs/plugin-timer';
|
import { TimerService } from '@cordisjs/plugin-timer';
|
||||||
import LoggerService from '@cordisjs/plugin-logger';
|
|
||||||
import Schema from 'schemastery';
|
import Schema from 'schemastery';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ export class Loader extends Service {
|
|||||||
private schemaCache = new WeakMap<Schema<any>, Record<string, Schema<any>>>();
|
private schemaCache = new WeakMap<Schema<any>, Record<string, Schema<any>>>();
|
||||||
// public warnings: Record<string, string> = Object.create(null);
|
// public warnings: Record<string, string> = Object.create(null);
|
||||||
|
|
||||||
static inject = ['setting', 'timer', 'i18n', 'logger'];
|
static inject = ['setting', 'timer', 'i18n'];
|
||||||
|
|
||||||
constructor(ctx: Context) {
|
constructor(ctx: Context) {
|
||||||
super(ctx, 'loader');
|
super(ctx, 'loader');
|
||||||
@@ -163,26 +162,18 @@ export class Loader extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.logger.exporter({
|
||||||
|
levels: { default: process.env.DEV ? 3 : 2 },
|
||||||
|
export: ({ name, type, args }) => (new Logger(name)[type] as (...args: any[]) => void)(...args),
|
||||||
|
});
|
||||||
app.plugin(ApiMixin);
|
app.plugin(ApiMixin);
|
||||||
app.plugin(TimerService);
|
app.plugin(TimerService);
|
||||||
app.plugin(LoggerService, {
|
|
||||||
console: {
|
|
||||||
showDiff: false,
|
|
||||||
showTime: 'dd hh:mm:ss',
|
|
||||||
label: {
|
|
||||||
align: 'right',
|
|
||||||
width: 9,
|
|
||||||
margin: 1,
|
|
||||||
},
|
|
||||||
levels: { default: process.env.DEV ? 3 : 2 },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
app.plugin(I18nService);
|
app.plugin(I18nService);
|
||||||
app.plugin(Loader);
|
app.plugin(Loader);
|
||||||
|
|
||||||
async function preload() {
|
async function preload() {
|
||||||
global.app = await new Promise((resolve) => {
|
global.app = await new Promise((resolve) => {
|
||||||
app.inject(['timer', 'i18n', 'logger', '$api'], (c) => {
|
app.inject(['timer', 'i18n', '$api'], (c) => {
|
||||||
c.inject({ domain: { required: false } }, resolve);
|
c.inject({ domain: { required: false } }, resolve);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user