Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
koa-colorful-logger
Advanced tools
A middleware for koa that can log colorful request info automatically. And you can also use it as a normal logger.
A middleware for koa that can log colorful request info automatically. And you can also use it as a normal logger.
$ npm install -S koa-colorful-logger
const Koa = require('koa');
const Logger = require('koa-colorful-logger');
const app = new Koa();
const logger = new Logger({
/**
* Should output logger info to file
* Default: false
*/
output: true,
/**
* Where is log file in
* Default: `./logs`
*/
outputDir: './logs',
/**
* Only when level exceed your setting will log info be output.
* Priority: DEBUG < INFO < WARNING < ERROR < CRITICAL
*/
outputLevel: 'INFO',
/**
* The format of the prefix.
* Default is: '[level][time] '
* Available variables:
* - [level]
* - [time]
*/
prefixFormat: '[level][time] ',
/**
* A function that should return a string for message.
* It will receive two args: 'ctx` and 'costTime'.
* Default is:
* ```javascript
* function (ctx, costTime) {
* return `${ctx.method} ${ctx.originalUrl} - ${ctx.status} - ${costTime}ms - ${ctx.ip}`;
* }
* ```
*/
msgFormatFunction: function (ctx, costTime) {
return `${ctx.method} ${ctx.originalUrl} - ${ctx.status} - ${costTime}ms - ${ctx.ip}`;
}
})
app.use(logger.middleware());
app.listen(4000);
You can use these api below to output your message.
logger.debug(msg);
logger.info(msg);
logger.warning(msg);
logger.error(msg);
logger.critical(msg);
/**
* Param bodyColorFunc should be chalk.ChalkFunction
*/
logger.log(level, bodyColorFunc, msg);
FAQs
security holding package
The npm package koa-colorful-logger receives a total of 1 weekly downloads. As such, koa-colorful-logger popularity was classified as not popular.
We found that koa-colorful-logger demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.