
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
debug-logfmt
Advanced tools
debug module.info, warn & error based from RFC 5424.DEBUG_COLORS by default.debug.duration for measurement.$ npm install debug-logfmt --save
Given a code like this one:
const debug = require('debug-logfmt')('metascraper')
debug('retry', { url: 'https://kikobeats.com' })
debug.info('done', { time: Date.now() })
debug.warn('token expired', { timestamp: Date.now() })
debug.error('whoops', { message: 'expected `number`, got `NaN`' })
You can:
DEBUG=debug-logfmt*DEBUG="*,-metascraper:info*" node example.jsSometimes you need to log the duration of a function:
const { setTimeout } = require('timers/promises')
const debug = require('debug-logfmt')('metascraper')
const duration = debug.duration()
setTimeout(1001).then(() => duration.error('timeout!'))
setTimeout(1100).then(() => duration.info('success'))
Required
Type: string
The env variable name to use for enabling logging using DEBUG.
Type: array
Default: ['debug', 'info', 'warn', 'error']
The log levels available.
It returns a function will print the duration in the next call.
const duration = debug.duration('query')
const result = await db.query(query)
duration(result)
debug-logfmt © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.
kikobeats.com · GitHub Kiko Beats · X @Kikobeats
FAQs
debug module using logfmt format
The npm package debug-logfmt receives a total of 110,786 weekly downloads. As such, debug-logfmt popularity was classified as popular.
We found that debug-logfmt demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.