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.
logdna-winston
Advanced tools
Node.js Winston library for logging to LogDNA
$ npm install --save logdna-winston
Please see @logdna/logger for instantiation options to passthrough to LogDNA's logger client.
This module also provides a transport object, which can be added to winston using:
const logdnaWinston = require('logdna-winston');
const winston = require('winston');
const logger = winston.createLogger({});
const options = {
key: apikey,
hostname: myHostname,
ip: ipAddress,
mac: macAddress,
app: appName,
env: envName,
level: level, // Default to debug, maximum level of log, doc: https://github.com/winstonjs/winston#logging-levels
indexMeta: true // Defaults to false, when true ensures meta object will be searchable
}
// Only add this line in order to track exceptions
options.handleExceptions = true;
logger.add(new logdnaWinston(options));
// log with meta
logger.log({
level: 'info'
, message: 'Log from LogDNA-winston'
, indexMeta: true // Optional. If not provided, it will use the default.
, data:'Some information' // Properties besides level, message and indexMetaare considered as "meta"
, error: new Error("It's a trap.") // Transport will parse the error object under property 'error'
})
// log without meta
logger.info('Info: Log from LogDNA-winston');
// A payload without 'message' will log the stringified object as the message
logger.info({
key: 'value'
, text: 'This is some text to get logged'
, bool: true
})
As per the Winston documentation, custom log levels may be used. In order to use such levels in LogDNA, custom levels must be defined for that logger as well.
const levels = {
error: 0
, warn: 1
, info: 2
, http: 3
, verbose: 4
, loquacious: 5
, ludicrous: 6
}
const logger = winston.createLogger({
levels
, level: 'ludicrous' // needed, or else it won't log levels <= to 'info'
})
const logdna_options = {
key: 'abc123'
, levels: Object.keys(levels)
}
logger.add(new logdnaWinston(logdna_options))
// Now the custom levels can be logged in Winston and LogDNA
logger.ludicrous('Some text')
logger.log({
msg: 'Custom level log message'
, key: 'value'
, bool: true
, level: 'loquacious'
})
Thanks goes to these wonderful people (emoji key):
Muaz Siddiqui 💻 📖 | Samir Musali 💻 📖 | Darin Spivey 💻 📖 | Mike Huang 💻 📖 | Brian Conn 📖 | Mario Casciaro 💻 | vilyapilya 🔧 |
Mike Del Tito 💻 🔧 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Copyright © LogDNA, released under an MIT license. See the LICENSE file and https://opensource.org/licenses/MIT
Happy Logging!
4.0.1 (2021-09-21)
FAQs
LogDNA's Node.js logging module with support for Winston
The npm package logdna-winston receives a total of 3,254 weekly downloads. As such, logdna-winston popularity was classified as popular.
We found that logdna-winston demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.