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.0.12 to 0.0.13

1

dist/index.d.ts

@@ -19,1 +19,2 @@ import Elysia from 'elysia';

export type { InferContext } from './types';
export { pino } from 'pino';

21

dist/index.js

@@ -29,9 +29,13 @@ import pino from 'pino';

delete options.autoLogging;
let log;
let app = new Elysia({
name: '@bogeychan/elysia-logger'
}).derive((ctx) => ({
log: typeof options.customProps === 'function'
? this.child(options.customProps(ctx))
: this
}));
name: '@bogeychan/elysia-logger',
seed: options
}).derive((ctx) => {
log =
typeof options.customProps === 'function'
? this.child(options.customProps(ctx))
: this;
return { log };
});
if (autoLogging) {

@@ -43,3 +47,3 @@ app = app

.onResponse((ctx) => {
if (ctx.log.level == 'silent') {
if (log.level == 'silent') {
return;

@@ -53,3 +57,3 @@ }

ctx.store.responseTime = ctx.store.endTime - ctx.store.startTime;
ctx.log.info(ctx);
log.info(ctx);
});

@@ -61,1 +65,2 @@ }

export * from './config';
export { pino } from 'pino';
{
"name": "@bogeychan/elysia-logger",
"version": "0.0.12",
"version": "0.0.13",
"description": "A plugin for Elysia.js for logging using the pino library",

@@ -5,0 +5,0 @@ "author": {

@@ -118,7 +118,7 @@ # @bogeychan/elysia-logger

logger({
autoLogging: true // default
autoLogging: false // disabled
autoLogging: true, // default
autoLogging: false, // disabled
autoLogging: {
ignore(ctx) {
return true // ignore logging for all requests
return true; // ignore logging for requests based on condition
}

@@ -133,6 +133,2 @@ }

## Author
[bogeychan](https://github.com/bogeychan)
## License

@@ -139,0 +135,0 @@

@@ -86,11 +86,16 @@ import pino from 'pino';

let log: Logger;
let app = new Elysia({
name: '@bogeychan/elysia-logger'
}).derive((ctx) => ({
log:
name: '@bogeychan/elysia-logger',
seed: options
}).derive((ctx) => {
log =
typeof options.customProps === 'function'
? this.child(options.customProps(ctx))
: this
}));
: this;
return { log };
});
if (autoLogging) {

@@ -106,3 +111,3 @@ app = (

.onResponse((ctx) => {
if (ctx.log.level == 'silent') {
if (log.level == 'silent') {
return;

@@ -119,8 +124,8 @@ }

ctx.log.info(ctx);
log.info(ctx);
});
// ! ctx.log is undefined or onError called twice for custom error...
// ! log is undefined or onError called twice for custom error...
// ? tested on elysia@0.7.17
// .onError((ctx) => {
// ctx.log.error(ctx);
// log.error(ctx);
// });

@@ -139,1 +144,3 @@ }

export { pino } from 'pino';
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