debug-logfmt 1.0.4 → 1.1.0

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 (4) hide show
  1. package/LICENSE +0 -0
  2. package/index.js +26 -3
  3. package/package.json +32 -34
  4. package/CHANGELOG.md +0 -36
package/LICENSE CHANGED
File without changes
package/index.js CHANGED
@@ -1,12 +1,35 @@
1
1
  'use strict'
2
2
 
3
+ const origDebug = require('debug')
4
+
5
+ /**
6
+ * This methods override the default `formatArgs` to don't print diff information.
7
+ */
8
+ if (process.env.DEBUG_COLORS === 'false') {
9
+ origDebug.formatArgs = function formatArgs (args) {
10
+ args[0] = this.namespace + ' ' + args[0]
11
+ }
12
+ } else {
13
+ origDebug.formatArgs = function formatArgs (args) {
14
+ const colorCode = `\u001B[3${
15
+ this.color < 8 ? this.color : `8;5;${this.color}`
16
+ }`
17
+ const prefix = ` ${colorCode};1m${this.namespace} \u001B[0m`
18
+ args[0] = prefix + args[0].replace(/\n/g, `\n${prefix}`)
19
+ }
20
+ }
21
+
3
22
  const { encode } = require('@jclem/logfmt2')
4
- const debug = require('debug-fabulous')(require('debug'))
23
+ const debug = require('debug-fabulous')(origDebug)
5
24
 
6
25
  const LEVELS = ['info', 'warn', 'error']
7
26
 
8
- const createLogger = log => (...args) =>
9
- log(args.map(arg => (typeof arg === 'string' ? arg : encode(arg))).join(' '))
27
+ const createLogger =
28
+ log =>
29
+ (...args) =>
30
+ log(
31
+ args.map(arg => (typeof arg === 'string' ? arg : encode(arg))).join(' ')
32
+ )
10
33
 
11
34
  module.exports = (env, { levels = LEVELS } = {}) => {
12
35
  const log = createLogger(debug(env))
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "debug-logfmt",
3
3
  "description": "debug module using logfmt format",
4
- "homepage": "https://nicedoc.io/Kikobeats/debug-logfmt",
5
- "version": "1.0.4",
4
+ "homepage": "https://github.com/Kikobeats/debug-logfmt",
5
+ "version": "1.1.0",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -27,12 +27,13 @@
27
27
  "winston"
28
28
  ],
29
29
  "dependencies": {
30
- "@jclem/logfmt2": "~2.4.0",
31
- "debug-fabulous": "~2.0.0"
30
+ "@jclem/logfmt2": "~2.4.3",
31
+ "debug-fabulous": "~2.0.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@commitlint/cli": "latest",
35
35
  "@commitlint/config-conventional": "latest",
36
+ "@ksmithut/prettier-standard": "latest",
36
37
  "ava": "latest",
37
38
  "ci-publish": "latest",
38
39
  "conventional-github-releaser": "latest",
@@ -40,11 +41,10 @@
40
41
  "finepack": "latest",
41
42
  "git-authors-cli": "latest",
42
43
  "git-dirty": "latest",
43
- "husky": "latest",
44
- "lint-staged": "latest",
44
+ "nano-staged": "latest",
45
45
  "npm-check-updates": "latest",
46
46
  "nyc": "latest",
47
- "prettier-standard": "latest",
47
+ "simple-git-hooks": "latest",
48
48
  "standard": "latest",
49
49
  "standard-markdown": "latest",
50
50
  "standard-version": "latest"
@@ -55,6 +55,30 @@
55
55
  "files": [
56
56
  "index.js"
57
57
  ],
58
+ "license": "MIT",
59
+ "commitlint": {
60
+ "extends": [
61
+ "@commitlint/config-conventional"
62
+ ]
63
+ },
64
+ "nano-staged": {
65
+ "*.js": [
66
+ "git add",
67
+ "prettier-standard"
68
+ ],
69
+ "*.md": [
70
+ "git add",
71
+ "standard-markdown"
72
+ ],
73
+ "package.json": [
74
+ "finepack",
75
+ "git add"
76
+ ]
77
+ },
78
+ "simple-git-hooks": {
79
+ "commit-msg": "npx commitlint --edit",
80
+ "pre-commit": "npx nano-staged"
81
+ },
58
82
  "scripts": {
59
83
  "clean": "rm -rf node_modules",
60
84
  "coverage": "nyc report --reporter=text-lcov | coveralls",
@@ -69,31 +93,5 @@
69
93
  "test": "exit 0",
70
94
  "update": "ncu -a",
71
95
  "update:check": "ncu -- --error-level 2"
72
- },
73
- "license": "MIT",
74
- "commitlint": {
75
- "extends": [
76
- "@commitlint/config-conventional"
77
- ]
78
- },
79
- "husky": {
80
- "hooks": {
81
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
82
- "pre-commit": "lint-staged"
83
- }
84
- },
85
- "lint-staged": {
86
- "package.json": [
87
- "finepack",
88
- "git add"
89
- ],
90
- "*.js": [
91
- "prettier-standard",
92
- "git add"
93
- ],
94
- "*.md": [
95
- "standard-markdown",
96
- "git add"
97
- ]
98
96
  }
99
- }
97
+ }
package/CHANGELOG.md DELETED
@@ -1,36 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ### [1.0.4](https://github.com/Kikobeats/debug-logfmt/compare/v1.0.3...v1.0.4) (2019-10-07)
6
-
7
- ### [1.0.3](https://github.com/Kikobeats/debug-logfmt/compare/v1.0.2...v1.0.3) (2019-08-23)
8
-
9
- ### [1.0.2](https://github.com/Kikobeats/debug-logfmt/compare/v1.0.1...v1.0.2) (2019-06-03)
10
-
11
-
12
- ### Bug Fixes
13
-
14
- * **package:** update logfmt to version 1.3.2 ([90640f6](https://github.com/Kikobeats/debug-logfmt/commit/90640f6))
15
-
16
-
17
-
18
- ### [1.0.1](https://github.com/Kikobeats/debug-logfmt/compare/v1.0.0...v1.0.1) (2019-05-21)
19
-
20
-
21
-
22
- ## [1.0.0](https://github.com/Kikobeats/debug-logfmt/compare/v0.0.1...v1.0.0) (2019-05-21)
23
-
24
-
25
-
26
- ### 0.0.1 (2019-05-21)
27
-
28
-
29
- ### Bug Fixes
30
-
31
- * linter ([9870aa2](https://github.com/Kikobeats/debug-logfmt/commit/9870aa2))
32
-
33
-
34
- ### Build System
35
-
36
- * **no-release:** first commit ([fdea7ad](https://github.com/Kikobeats/debug-logfmt/commit/fdea7ad))