Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@bogeychan/elysia-logger
Advanced tools
A plugin for Elysia.js for logging using the pino library
bun add @bogeychan/elysia-logger
import { Elysia } from 'elysia';
import { logger } from '@bogeychan/elysia-logger';
const app = new Elysia()
.use(
logger({
level: 'error'
})
)
.get('/', (ctx) => {
ctx.log.error(ctx, 'Context');
ctx.log.info(ctx.request, 'Request'); // noop
return 'Hello World';
})
.listen(8080);
console.log(`Listening on http://${app.server!.hostname}:${app.server!.port}`);
import { fileLogger } from '@bogeychan/elysia-logger';
fileLogger({
file: './my.log'
});
import { logger } from '@bogeychan/elysia-logger';
logger({
stream: ... // default -> console output
});
import { logger } from '@bogeychan/elysia-logger';
const myPlugin = () => (app: Elysia) => app.decorate('myProperty', 42);
// ...
app = app.use(myPlugin());
app
.use(
logger({
/**
* This function will be invoked for each `log`-method called with `context`
* where you can pass additional properties that need to be logged
*/
customProps(
ctx: ElysiaContextForInstance<InferElysiaInstance<typeof app>>
) {
return {
params: ctx.params,
query: ctx.query,
myProperty: ctx.myProperty
};
}
})
)
.get('/', (ctx) => {
ctx.log.info(ctx, 'Context');
return 'with-context';
})
.listen(8080);
You can find the entire example in the examples folder.
import { Elysia } from 'elysia';
import { logger } from '@bogeychan/elysia-logger';
const app = new Elysia()
.use(
logger({
contextKeyName: 'myLogger'
})
)
.get('/', (ctx) => {
// property "myLogger" is available instead of "log"
ctx.myLogger.info(ctx.request, 'Request');
return 'Hello World';
})
.listen(8080);
console.log(`Listening on http://${app.server!.hostname}:${app.server!.port}`);
Checkout the examples folder on github for further use cases such as the integration of pino-pretty for readable console outputs.
0.0.5 - 08 Sep 2023
Feature:
FAQs
A plugin for Elysia.js for logging using the pino library
The npm package @bogeychan/elysia-logger receives a total of 8,594 weekly downloads. As such, @bogeychan/elysia-logger popularity was classified as popular.
We found that @bogeychan/elysia-logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.