diff --git a/bun.lockb b/bun.lockb index d3aebe9..681598b 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 8cedbe4..b6e5194 100644 --- a/package.json +++ b/package.json @@ -34,17 +34,17 @@ "release": "npm run build && npm run test && npm publish --access public" }, "peerDependencies": { - "elysia": ">= 1.1.0" + "elysia": ">= 1.2.2" }, "devDependencies": { "@types/bun": "^1.1.14", - "elysia": "1.1.0", + "elysia": "1.2.2", "pino-pretty": "^13.0.0", "tsd": "^0.31.2", "typescript": "^5.7.2" }, "dependencies": { - "pino": "^9.5.0" + "pino": "^9.6.0" }, "homepage": "https://github.com/bogeychan/elysia-logger", "bugs": "https://github.com/bogeychan/elysia-logger/issues", diff --git a/src/index.ts b/src/index.ts index fd597f4..73352fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -112,7 +112,7 @@ function into(this: Logger, options: ElysiaLoggerOptions = {}) { .onRequest((ctx) => { ctx.store = { ...ctx.store, startTime: performance.now() }; }) - .onAfterResponse({ as: "global" }, (ctx) => { + .onAfterResponse((ctx) => { const loggerCtx = ctx as unknown as ElysiaLoggerContext; loggerCtx.isError = false; @@ -132,7 +132,7 @@ function into(this: Logger, options: ElysiaLoggerOptions = {}) { log[useLevel](ctx); }) - .onError({ as: "global" }, (ctx) => { + .onError((ctx) => { const loggerCtx = ctx as ElysiaLoggerContext; loggerCtx.isError = true; @@ -151,7 +151,8 @@ function into(this: Logger, options: ElysiaLoggerOptions = {}) { } else { log.error(ctx); } - }); + }) + .as("global"); } return app; diff --git a/src/types.ts b/src/types.ts index 77fdd05..fa8682c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -99,7 +99,6 @@ export type Logger = pino.Logger & BaseLoggerOptions; export type InferContext = T extends Elysia< infer _Path, - infer _Scoped, infer Singleton, infer Definitions, infer _Metadata, @@ -160,7 +159,6 @@ export type _INTERNAL_ElysiaLoggerPlugin< Store extends Elysia["store"] = Elysia["store"] > = Elysia< "", - false, { store: Store; derive: { readonly log: Logger };