
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
stackdriver-logging-bunyan-koa
Advanced tools
Koa middleware for Bunyan stream to Stackdriver Logging
This module provides an Koa middleware for working with Stackdriver Logging, compatible with Bunyan.
The implementation is adopted from the exsting express middleware implementation in nodejs-logging-bunyan module.
For general documentation on bunyan logging to Stackdriver please refer to the nodejs-logging-bunyan module.
npm install stackdriver-logging-bunyan-koa
We provide a middleware that can be used in an koa application. Apart from being easy to use, this enables some more powerful features of Stackdriver Logging: request bundling. Any application logs emitted on behalf of a specific request will be shown nested inside the request log.
The middleware adds a bunyan
-style log function to the ctx
object. You
can use this wherever you have access to the ctx
object. All log entries that
are made on behalf of a specific request are shown bundled together in the
Stackdriver Logging UI.
const lb = require('stackdriver-logging-bunyan-koa');
// Import koa module and create an http server.
const koa = require('koa');
async function startServer() {
const {logger, mw} = await lb.koa.middleware();
const app = koa();
// Install the logging middleware. This ensures that a Bunyan-style `log`
// function is available on the `context` object. Attach this as one of the
// earliest middleware to make sure that log function is available in all the
// subsequent middleware and routes.
app.use(mw);
// Setup an http route and a route handler.
app.use(async (ctx) => {
// `ctx.log` can be used as a bunyan style log method. All logs generated
// using `ctx.log` use the current request context. That is, all logs
// corresponding to a specific request will be bundled in the Stackdriver
// UI.
ctx.log.info('this is an info log message');
ctx.body = 'hello world';
});
// `logger` can be used as a global logger, one not correlated to any specific
// request.
logger.info({port: 8080}, 'bonjour');
// Start listening on the http server.
app.listen(8080, () => {
console.log('http server listening on port 8080');
});
}
startServer();
Contributions welcome!
Apache Version 2.0
FAQs
Koa middleware for Bunyan stream to Stackdriver Logging
The npm package stackdriver-logging-bunyan-koa receives a total of 2 weekly downloads. As such, stackdriver-logging-bunyan-koa popularity was classified as not popular.
We found that stackdriver-logging-bunyan-koa demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.