
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@nioh/logger
Advanced tools
Install with npm
npm i @server/elk --registry=http://npm.zkh360.com
日志中间件,elk
import * as path from 'path'
import * as Koa from 'koa'
import * as env from '@server/env'
import elk from '@server/elk'
const app = new Koa()
// 初始化 ELK 配置,/zkh/log/ 为固定目录,不可修改
const project = 'your-project-name'
app.use(elk({
project,
filename: env.LOCAL ? path.resolve(__dirname, '../log/logstash.log') : `/zkh/log/${project}/logstash.log`
}))
// debug, warn, error
app.use((ctx, next) => {
// eg: 请求响应大于 300 ms, 可记录一条 Warning 日志
ctx.elk.warn({
message: 'slow response',
type: 'api',
})
// eg: 当 catch 了某个错误,可记录一条 Error 日志
ctx.elk.error({
message: err.message,
type: 'api',
})
await next()
})
app.listen(3000)
日志:log example
app.on('error', (err, ctx) => {
debug('APP ERROR: ', ctx)
ctx && ctx.elk && ctx.elk.error({
message: err.message,
type: 'app'
})
})
npm test
2019@ZKH-FE
FAQs
server logger which write file on disk
The npm package @nioh/logger receives a total of 4 weekly downloads. As such, @nioh/logger popularity was classified as not popular.
We found that @nioh/logger 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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.