nightingale-console 12.1.3 → 13.0.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.
- package/CHANGELOG.md +33 -0
- package/README.md +3 -0
- package/dist/{index.d.ts → definitions/index.d.ts} +1 -2
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/{index-node14.mjs → index-node16.mjs} +1 -7
- package/dist/index-node16.mjs.map +1 -0
- package/package.json +24 -33
- package/src/index.ts +3 -2
- package/dist/index-node14.cjs.js +0 -40
- package/dist/index-node14.cjs.js.map +0 -1
- package/dist/index-node14.mjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/rollup.config.mjs +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [13.0.0](https://github.com/christophehurpeau/nightingale/compare/v12.1.4...v13.0.0) (2022-11-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* drop node 14 and cjs ([9a8ca06](https://github.com/christophehurpeau/nightingale/commit/9a8ca064449ddc0d69e26543e21c2d522536c50a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* build for node 16 ([30ae3e9](https://github.com/christophehurpeau/nightingale/commit/30ae3e9c455dbad793c2f704b9d860069dc80c32))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### BREAKING CHANGES
|
|
20
|
+
|
|
21
|
+
* dropped node 14 and cjs
|
|
22
|
+
* drop node 14
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [12.1.4](https://github.com/christophehurpeau/nightingale/compare/v12.1.3...v12.1.4) (2022-02-05)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* cjs build ([2e24ac5](https://github.com/christophehurpeau/nightingale/commit/2e24ac5753ee386c5be9ca56796194ee598f10ff))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
## [12.1.3](https://github.com/christophehurpeau/nightingale/compare/v12.1.2...v12.1.3) (2022-01-15)
|
|
7
40
|
|
|
8
41
|
**Note:** Version bump only for package nightingale-console
|
package/README.md
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/npm/v/nightingale-console.svg?style=flat-square"></a>
|
|
11
|
+
<a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/npm/dw/nightingale-console.svg?style=flat-square"></a>
|
|
12
|
+
<a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/node/v/nightingale-console.svg?style=flat-square"></a>
|
|
13
|
+
<a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/npm/types/nightingale-console.svg?style=flat-square"></a>
|
|
11
14
|
</p>
|
|
12
15
|
|
|
13
16
|
## Install
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Level } from 'nightingale-levels';
|
|
2
2
|
import type { IsHandling, Handle, LogRecord, Metadata, Handler } from 'nightingale-types';
|
|
3
|
-
interface ConsoleHandlerOptions {
|
|
3
|
+
export interface ConsoleHandlerOptions {
|
|
4
4
|
formatter?: <T extends Metadata>(record: LogRecord<T>) => string;
|
|
5
5
|
output?: <T extends Metadata>(param: string | string[], record: LogRecord<T>) => void;
|
|
6
6
|
theme?: 'dark' | 'light';
|
|
@@ -11,5 +11,4 @@ export declare class ConsoleHandler implements Handler {
|
|
|
11
11
|
handle: Handle;
|
|
12
12
|
constructor(minLevel: Level, options?: ConsoleHandlerOptions);
|
|
13
13
|
}
|
|
14
|
-
export {};
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,mBAAmB,CAAC;AAmB3B,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;IACjE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KACjB,IAAI,CAAC;IAEV,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,EAAE,KAAK,CAAa;IAE5B,UAAU,EAAE,UAAU,CAAC;IAEvB,MAAM,EAAE,MAAM,CAAC;gBAEH,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAE,qBAA0B;CAMjE"}
|
|
@@ -5,26 +5,20 @@ import formatterJSON from 'nightingale-json-formatter';
|
|
|
5
5
|
import { Level } from 'nightingale-levels';
|
|
6
6
|
|
|
7
7
|
const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON : formatterANSI;
|
|
8
|
-
|
|
9
8
|
const createHandle = (formatter = defaultFormatter, output = consoleOutput) => {
|
|
10
9
|
return record => {
|
|
11
10
|
output(formatter(record), record);
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
|
-
|
|
15
13
|
const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
|
|
16
14
|
class ConsoleHandler {
|
|
17
15
|
minLevel = Level.ALL;
|
|
18
|
-
|
|
19
16
|
constructor(minLevel, options = {}) {
|
|
20
17
|
this.minLevel = minLevel;
|
|
21
|
-
|
|
22
18
|
this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
|
|
23
|
-
|
|
24
19
|
this.handle = createHandle(options.formatter, options.output);
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
export { ConsoleHandler };
|
|
30
|
-
//# sourceMappingURL=index-
|
|
24
|
+
//# sourceMappingURL=index-node16.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node16.mjs","sources":["../src/index.ts"],"sourcesContent":["import { POB_TARGET } from 'pob-babel';\nimport formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport { Level } from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n POB_TARGET === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\nexport interface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","minLevel","Level","ALL","constructor","options","isHandling","level","key","handle"],"mappings":";;;;;;AAcA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAM,CAACC,KAAK,IACrBF,OAAO,CAACG,GAAG,CAACC,6BAA6B,KAAK,MAAM,GAChDC,aAAa,GACbC,aAAa,CAAA;AAEnB,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBAAgB,EAC5BU,MAAM,GAAGC,aAAa,KACX;AACX,EAAA,OAA4BC,MAAoB,IAAW;AACzDF,IAAAA,MAAM,CAACD,SAAS,CAACG,MAAM,CAAC,EAAEA,MAAM,CAAC,CAAA;GAClC,CAAA;AACH,CAAC,CAAA;AACD,MAAMC,cAAc,GAAGC,oBAAoB,CAACb,OAAO,CAACG,GAAG,CAACW,KAAK,CAAC,CAAA;AAYvD,MAAMC,cAAc,CAAoB;EAC7CC,QAAQ,GAAUC,KAAK,CAACC,GAAG,CAAA;AAM3BC,EAAAA,WAAW,CAACH,QAAe,EAAEI,OAA8B,GAAG,EAAE,EAAE;IAChE,IAAI,CAACJ,QAAQ,GAAGA,QAAQ,CAAA;AACxB,IAAA,IAAI,CAACK,UAAU,GAAG,CAACC,KAAY,EAAEC,GAAW,KAC1CD,KAAK,IAAIV,cAAc,CAACI,QAAQ,EAAEO,GAAG,CAAC,CAAA;AACxC,IAAA,IAAI,CAACC,MAAM,GAAGjB,YAAY,CAACa,OAAO,CAACZ,SAAS,EAAEY,OAAO,CAACX,MAAM,CAAC,CAAA;AAC/D,GAAA;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nightingale-console",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Console handler for nightingale",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nightingale",
|
|
@@ -16,43 +16,34 @@
|
|
|
16
16
|
"homepage": "https://github.com/christophehurpeau/nightingale",
|
|
17
17
|
"type": "module",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": "
|
|
19
|
+
"node": ">=16.0.0"
|
|
20
20
|
},
|
|
21
|
-
"main": "./dist/index-
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
21
|
+
"main": "./dist/index-node16.mjs",
|
|
22
|
+
"types": "./dist/definitions/index.d.ts",
|
|
23
23
|
"exports": {
|
|
24
24
|
"./package.json": "./package.json",
|
|
25
25
|
".": {
|
|
26
26
|
"node": {
|
|
27
|
-
"import": "./dist/index-
|
|
28
|
-
"require": "./dist/index-node14.cjs.js"
|
|
27
|
+
"import": "./dist/index-node16.mjs"
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
},
|
|
32
|
-
"module:node": "./dist/index-node14.mjs",
|
|
33
31
|
"sideEffects": false,
|
|
34
32
|
"scripts": {
|
|
35
|
-
"build": "
|
|
36
|
-
"build:definitions": "tsc -p
|
|
37
|
-
"clean": "
|
|
33
|
+
"build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
|
|
34
|
+
"build:definitions": "tsc -p",
|
|
35
|
+
"clean": "yarn clean:build",
|
|
36
|
+
"clean:build": "pob-babel-clean-out dist",
|
|
38
37
|
"lint": "yarn run lint:eslint",
|
|
39
|
-
"lint:eslint": "
|
|
40
|
-
"watch": "
|
|
41
|
-
},
|
|
42
|
-
"prettier": {
|
|
43
|
-
"trailingComma": "all",
|
|
44
|
-
"singleQuote": true,
|
|
45
|
-
"arrowParens": "always"
|
|
38
|
+
"lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-console",
|
|
39
|
+
"watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
|
|
46
40
|
},
|
|
41
|
+
"prettier": "@pob/root/prettier-config",
|
|
47
42
|
"pob": {
|
|
48
43
|
"babelEnvs": [
|
|
49
44
|
{
|
|
50
45
|
"target": "node",
|
|
51
|
-
"version": "
|
|
52
|
-
"formats": [
|
|
53
|
-
"cjs",
|
|
54
|
-
"es"
|
|
55
|
-
]
|
|
46
|
+
"version": "16"
|
|
56
47
|
}
|
|
57
48
|
],
|
|
58
49
|
"entries": [
|
|
@@ -60,18 +51,18 @@
|
|
|
60
51
|
]
|
|
61
52
|
},
|
|
62
53
|
"dependencies": {
|
|
63
|
-
"@types/node": ">=
|
|
64
|
-
"nightingale-ansi-formatter": "
|
|
65
|
-
"nightingale-console-output": "
|
|
66
|
-
"nightingale-debug": "
|
|
67
|
-
"nightingale-json-formatter": "
|
|
68
|
-
"nightingale-levels": "
|
|
69
|
-
"nightingale-types": "
|
|
54
|
+
"@types/node": ">=16.0.0",
|
|
55
|
+
"nightingale-ansi-formatter": "13.0.0",
|
|
56
|
+
"nightingale-console-output": "13.0.0",
|
|
57
|
+
"nightingale-debug": "13.0.0",
|
|
58
|
+
"nightingale-json-formatter": "13.0.0",
|
|
59
|
+
"nightingale-levels": "13.0.0",
|
|
60
|
+
"nightingale-types": "13.0.0"
|
|
70
61
|
},
|
|
71
62
|
"devDependencies": {
|
|
72
|
-
"@babel/core": "7.
|
|
73
|
-
"pob-babel": "
|
|
74
|
-
"typescript": "4.
|
|
63
|
+
"@babel/core": "7.20.2",
|
|
64
|
+
"pob-babel": "35.3.0",
|
|
65
|
+
"typescript": "4.9.3"
|
|
75
66
|
},
|
|
76
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "52cf7e3c8762a07891da9dde497ec03298c15654"
|
|
77
68
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { POB_TARGET } from 'pob-babel';
|
|
1
2
|
import formatterANSI from 'nightingale-ansi-formatter';
|
|
2
3
|
import consoleOutput from 'nightingale-console-output';
|
|
3
4
|
import { createFindDebugLevel } from 'nightingale-debug';
|
|
@@ -12,7 +13,7 @@ import type {
|
|
|
12
13
|
} from 'nightingale-types';
|
|
13
14
|
|
|
14
15
|
const defaultFormatter =
|
|
15
|
-
|
|
16
|
+
POB_TARGET === 'node' &&
|
|
16
17
|
!process.stdout.isTTY &&
|
|
17
18
|
process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'
|
|
18
19
|
? formatterJSON
|
|
@@ -28,7 +29,7 @@ const createHandle = (
|
|
|
28
29
|
};
|
|
29
30
|
const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
|
|
30
31
|
|
|
31
|
-
interface ConsoleHandlerOptions {
|
|
32
|
+
export interface ConsoleHandlerOptions {
|
|
32
33
|
formatter?: <T extends Metadata>(record: LogRecord<T>) => string;
|
|
33
34
|
output?: <T extends Metadata>(
|
|
34
35
|
param: string | string[],
|
package/dist/index-node14.cjs.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const formatterANSI = require('nightingale-ansi-formatter');
|
|
6
|
-
const consoleOutput = require('nightingale-console-output');
|
|
7
|
-
const nightingaleDebug = require('nightingale-debug');
|
|
8
|
-
const formatterJSON = require('nightingale-json-formatter');
|
|
9
|
-
const nightingaleLevels = require('nightingale-levels');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
12
|
-
|
|
13
|
-
const formatterANSI__default = /*#__PURE__*/_interopDefaultLegacy(formatterANSI);
|
|
14
|
-
const consoleOutput__default = /*#__PURE__*/_interopDefaultLegacy(consoleOutput);
|
|
15
|
-
const formatterJSON__default = /*#__PURE__*/_interopDefaultLegacy(formatterJSON);
|
|
16
|
-
|
|
17
|
-
const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON__default : formatterANSI__default;
|
|
18
|
-
|
|
19
|
-
const createHandle = (formatter = defaultFormatter, output = consoleOutput__default) => {
|
|
20
|
-
return record => {
|
|
21
|
-
output(formatter(record), record);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const findDebugLevel = nightingaleDebug.createFindDebugLevel(process.env.DEBUG);
|
|
26
|
-
class ConsoleHandler {
|
|
27
|
-
minLevel = nightingaleLevels.Level.ALL;
|
|
28
|
-
|
|
29
|
-
constructor(minLevel, options = {}) {
|
|
30
|
-
this.minLevel = minLevel;
|
|
31
|
-
|
|
32
|
-
this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
|
|
33
|
-
|
|
34
|
-
this.handle = createHandle(options.formatter, options.output);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
exports.ConsoleHandler = ConsoleHandler;
|
|
40
|
-
//# sourceMappingURL=index-node14.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-node14.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport { Level } from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n __POB_TARGET__ === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","minLevel","Level","ALL","constructor","options","isHandling","level","key","handle"],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,sBAHJ,GAIIC,sBALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,sBAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzDF,IAAAA,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAN;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,qCAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAC7CC,EAAAA,QAAQ,GAAUC,uBAAK,CAACC,GAAhB;;AAMRC,EAAAA,WAAW,CAACH,QAAD,EAAkBI,OAA8B,GAAG,EAAnD,EAAuD;AAChE,SAAKJ,QAAL,GAAgBA,QAAhB;;AACA,SAAKK,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACI,QAAD,EAAWO,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACa,OAAO,CAACZ,SAAT,EAAoBY,OAAO,CAACX,MAA5B,CAA1B;AACD;;AAZ4C;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-node14.mjs","sources":["../src/index.ts"],"sourcesContent":["import formatterANSI from 'nightingale-ansi-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport formatterJSON from 'nightingale-json-formatter';\nimport { Level } from 'nightingale-levels';\nimport type {\n IsHandling,\n Handle,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\n\nconst defaultFormatter =\n __POB_TARGET__ === 'node' &&\n !process.stdout.isTTY &&\n process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'\n ? formatterJSON\n : formatterANSI;\n\nconst createHandle = (\n formatter = defaultFormatter,\n output = consoleOutput,\n): Handle => {\n return <T extends Metadata>(record: LogRecord<T>): void => {\n output(formatter(record), record);\n };\n};\nconst findDebugLevel = createFindDebugLevel(process.env.DEBUG);\n\ninterface ConsoleHandlerOptions {\n formatter?: <T extends Metadata>(record: LogRecord<T>) => string;\n output?: <T extends Metadata>(\n param: string | string[],\n record: LogRecord<T>,\n ) => void;\n // compat with nightingale-app-console, not used yet\n theme?: 'dark' | 'light';\n}\n\nexport class ConsoleHandler implements Handler {\n minLevel: Level = Level.ALL;\n\n isHandling: IsHandling;\n\n handle: Handle;\n\n constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {\n this.minLevel = minLevel;\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n this.handle = createHandle(options.formatter, options.output);\n }\n}\n"],"names":["defaultFormatter","process","stdout","isTTY","env","NIGHTINGALE_CONSOLE_FORMATTER","formatterJSON","formatterANSI","createHandle","formatter","output","consoleOutput","record","findDebugLevel","createFindDebugLevel","DEBUG","ConsoleHandler","minLevel","Level","ALL","constructor","options","isHandling","level","key","handle"],"mappings":";;;;;;AAaA,MAAMA,gBAAgB,GAEpB,CAACC,OAAO,CAACC,MAAR,CAAeC,KADhB,IAEAF,OAAO,CAACG,GAAR,CAAYC,6BAAZ,KAA8C,MAF9C,GAGIC,aAHJ,GAIIC,aALN;;AAOA,MAAMC,YAAY,GAAG,CACnBC,SAAS,GAAGT,gBADO,EAEnBU,MAAM,GAAGC,aAFU,KAGR;AACX,SAA4BC,MAArB,IAAoD;AACzDF,IAAAA,MAAM,CAACD,SAAS,CAACG,MAAD,CAAV,EAAoBA,MAApB,CAAN;AACD,GAFD;AAGD,CAPD;;AAQA,MAAMC,cAAc,GAAGC,oBAAoB,CAACb,OAAO,CAACG,GAAR,CAAYW,KAAb,CAA3C;AAYO,MAAMC,cAAN,CAAwC;AAC7CC,EAAAA,QAAQ,GAAUC,KAAK,CAACC,GAAhB;;AAMRC,EAAAA,WAAW,CAACH,QAAD,EAAkBI,OAA8B,GAAG,EAAnD,EAAuD;AAChE,SAAKJ,QAAL,GAAgBA,QAAhB;;AACA,SAAKK,UAAL,GAAkB,CAACC,KAAD,EAAeC,GAAf,KAChBD,KAAK,IAAIV,cAAc,CAACI,QAAD,EAAWO,GAAX,CADzB;;AAEA,SAAKC,MAAL,GAAcjB,YAAY,CAACa,OAAO,CAACZ,SAAT,EAAoBY,OAAO,CAACX,MAA5B,CAA1B;AACD;;AAZ4C;;;;"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,mBAAmB,CAAC;AAmB3B,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;IACjE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,QAAQ,EAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,KACjB,IAAI,CAAC;IAEV,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,EAAE,KAAK,CAAa;IAE5B,UAAU,EAAE,UAAU,CAAC;IAEvB,MAAM,EAAE,MAAM,CAAC;gBAEH,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAE,qBAA0B;CAMjE"}
|
package/rollup.config.mjs
DELETED