debug-logfmt 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +15 -13
  3. package/package.json +6 -5
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ## Highlights
8
8
 
9
9
  - Based on [`debug`](https://www.npmjs.com/package/debug), use `DEBUG` for enable/disable logging.
10
- - Expose `info`, `warn` and `error` logging levels.
10
+ - Expose `info`, `warn` and `error` logging levels, inspired from [RFC 5424](https://datatracker.ietf.org/doc/html/rfc5424).
11
11
  - Format messages using Heroku [logfmt](https://brandur.org/logfmt) syntax.
12
12
 
13
13
  ## Install
package/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  'use strict'
2
2
 
3
- const timeSpan = require('@kikobeats/time-span')({
4
- format: require('pretty-ms')
5
- })
6
3
  const { encode } = require('@jclem/logfmt2')
4
+ const { format } = require('@lukeed/ms')
7
5
  const origDebug = require('debug')
8
6
 
7
+ const timeSpan = require('@kikobeats/time-span')({
8
+ format: n => format(Math.round(n))
9
+ })
10
+
9
11
  /**
10
12
  * This methods override the default `formatArgs` to don't print diff information.
11
13
  */
@@ -29,10 +31,10 @@ const LEVELS = ['info', 'warn', 'error']
29
31
 
30
32
  const createLogger =
31
33
  log =>
32
- (...args) =>
33
- log(
34
- args.map(arg => (typeof arg === 'string' ? arg : encode(arg))).join(' ')
35
- )
34
+ (...args) =>
35
+ log(
36
+ args.map(arg => (typeof arg === 'string' ? arg : encode(arg))).join(' ')
37
+ )
36
38
 
37
39
  module.exports = (env, { levels = LEVELS } = {}) => {
38
40
  const debug = createLogger(createDebug(env))
@@ -45,12 +47,12 @@ module.exports = (env, { levels = LEVELS } = {}) => {
45
47
 
46
48
  const create =
47
49
  type =>
48
- (...opts) => {
49
- ;(type ? debug[type] : debug)(...args, ...opts, {
50
- duration: duration()
51
- })
52
- return true
53
- }
50
+ (...opts) => {
51
+ ;(type ? debug[type] : debug)(...args, ...opts, {
52
+ duration: duration()
53
+ })
54
+ return true
55
+ }
54
56
 
55
57
  const fn = create()
56
58
  fn.error = create('error')
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "debug-logfmt",
3
3
  "description": "debug module using logfmt format",
4
4
  "homepage": "https://github.com/Kikobeats/debug-logfmt",
5
- "version": "1.2.0",
5
+ "version": "1.2.1",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -29,8 +29,8 @@
29
29
  "dependencies": {
30
30
  "@jclem/logfmt2": "~2.4.3",
31
31
  "@kikobeats/time-span": "~1.0.2",
32
- "debug-fabulous": "~2.0.2",
33
- "pretty-ms": "~7.0.1"
32
+ "@lukeed/ms": "~2.0.2",
33
+ "debug-fabulous": "~2.0.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@commitlint/cli": "latest",
@@ -38,11 +38,12 @@
38
38
  "@ksmithut/prettier-standard": "latest",
39
39
  "ava": "latest",
40
40
  "ci-publish": "latest",
41
- "conventional-github-releaser": "latest",
42
41
  "coveralls": "latest",
42
+ "debug": "latest",
43
43
  "finepack": "latest",
44
44
  "git-authors-cli": "latest",
45
45
  "git-dirty": "latest",
46
+ "github-generate-release": "latest",
46
47
  "nano-staged": "latest",
47
48
  "npm-check-updates": "latest",
48
49
  "nyc": "latest",
@@ -90,7 +91,7 @@
90
91
  "pretest": "npm run lint",
91
92
  "pretty": "prettier-standard index.js {core,test,bin,scripts}/**/*.js --single-quote --print-width 100",
92
93
  "release": "git-authors-cli && git add package.json && standard-version -a",
93
- "release:github": "conventional-github-releaser -p angular",
94
+ "release:github": "github-generate-release",
94
95
  "release:tags": "git push --follow-tags origin HEAD:master",
95
96
  "test": "exit 0",
96
97
  "update": "ncu -a",