Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bogeychan/elysia-logger

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bogeychan/elysia-logger - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

1

dist/index.d.ts

@@ -21,2 +21,3 @@ import pino from "pino";

macro: {};
macroFn: {};
}, {}, {

@@ -23,0 +24,0 @@ derive: {};

2

dist/index.js

@@ -47,3 +47,3 @@ import pino from "pino";

})
.onResponse({ as: "global" }, (ctx) => {
.onAfterResponse({ as: "global" }, (ctx) => {
const loggerCtx = ctx;

@@ -50,0 +50,0 @@ loggerCtx.isError = false;

{
"name": "@bogeychan/elysia-logger",
"version": "0.1.0",
"version": "0.1.1",
"description": "A plugin for Elysia.js for logging using the pino library",

@@ -37,7 +37,7 @@ "author": {

"peerDependencies": {
"elysia": ">= 1.0.27"
"elysia": ">= 1.1.0"
},
"devDependencies": {
"@types/bun": "1.0",
"elysia": "1.0.27",
"elysia": "1.1.0",
"pino-pretty": "^11.2.1",

@@ -44,0 +44,0 @@ "tsd": "^0.30.7",

@@ -56,3 +56,3 @@ # @bogeychan/elysia-logger

### Include additional request context info for debugging tools
### Include additional request context info

@@ -66,4 +66,10 @@ ```ts

app = app.use(myPlugin());
class MyError extends Error {
constructor(message: string, public myValue: string) {
super(message);
}
}
app = app.error("myError", MyError).use(myPlugin());
app

@@ -77,2 +83,8 @@ .use(

customProps(ctx: InferContext<typeof app>) {
if (ctx.isError && ctx.code === "myError") {
return {
myValue: ctx.error.myValue,
};
}
return {

@@ -90,2 +102,5 @@ params: ctx.params,

return "with-context";
})
.get("/error", () => {
throw new MyError("whelp", "yay");
});

@@ -110,7 +125,7 @@ ```

throw { message: "1234", name: "MyError" };
throw new Error("whelp");
});
```
### Automatic `onResponse` logging by `default`; based on [pino-http](https://github.com/pinojs/pino-http)
### Automatic `onAfterResponse` & `onError` logging by `default`; based on [pino-http](https://github.com/pinojs/pino-http)

@@ -117,0 +132,0 @@ ```ts

@@ -114,3 +114,3 @@ import pino from "pino";

})
.onResponse({ as: "global" }, (ctx) => {
.onAfterResponse({ as: "global" }, (ctx) => {
const loggerCtx = ctx as unknown as ElysiaLoggerContext;

@@ -117,0 +117,0 @@ loggerCtx.isError = false;

@@ -57,3 +57,3 @@ import type { pino } from "pino";

/**
* Disable the automatic "onResponse" logging
* Disable the automatic "onAfterResponse" & "onError" logging
*

@@ -60,0 +60,0 @@ * @default true

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc