
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
express-log-middleware
Advanced tools
app.use(
require('express-log-middleware')(config)
);
name | type | description |
---|---|---|
config.model | string | 项目模板名称(用于指定Elasticsearch中的index) 必填项 |
config.level | string | 日志输出级别 |
config.logDir | string | 日志输出路径 |
config.getBusinessData | function | 获取业务专有数据(这些数据会一同发送到日志服务) 参数 params req |
config.onParams | function | 对缺省params进行处理,返回处理后params 参数 params req |
config.logEnv | string | 日志环境 目前EFK/ELK 项目迁移进openshift之后使用其中集成的EFK不用再使用log4js收集日志; default: "ELK" |
//logEnv = "EFK"
app.use(
require('express-log-middleware')({logEnv: 'EFK'}); //如果logEnv是EFK, 只用这一个配置即可;
)
//logEnv = "ELK"
app.use(
require('express-log-middleware')({model: 'education_cloud'})
);
app.use(
require('express-log-middleware')({
model: 'education_cloud',
onParams: (params,req) => ({userId:req.user.id})
})
);
app.use(require('express-log-middleware')({
model: 'education_cloud',
getBusinessData: function (params, req) {
let user = req.user || {};
const customer = req.customer || {};
return {
userId: user.id || -1,
customeUrl:customer.url || '-'
}
}
}));
req.logger.log('xxx')
req.logger.error('xxx')
console.log(JSON.stringify({})); //如果输出日志是jsonstring, EFK会处parse之后提取key/value
console.log('this is a test'); //字符串输出
console.warn('debug尽量不要换行输出');
FAQs
### 说明
The npm package express-log-middleware receives a total of 1 weekly downloads. As such, express-log-middleware popularity was classified as not popular.
We found that express-log-middleware 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.