nightingale-console 14.2.1 → 16.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 CHANGED
@@ -3,6 +3,42 @@
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
+ ## [16.0.0](https://github.com/christophehurpeau/nightingale/compare/v15.0.0...v16.0.0) (2025-03-30)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * drop node 18
11
+
12
+ ### Features
13
+
14
+ * drop node 18 ([1b11a55](https://github.com/christophehurpeau/nightingale/commit/1b11a55dd24c9435be50519a748316079f554414))
15
+
16
+ ### Bug Fixes
17
+
18
+ * fix lib exports ([5b562b2](https://github.com/christophehurpeau/nightingale/commit/5b562b245aac1aa86b728a9433f3c9d28c62fe04))
19
+
20
+ Version bump for dependency: nightingale
21
+
22
+
23
+ ## [15.0.0](https://github.com/christophehurpeau/nightingale/compare/v14.2.1...v15.0.0) (2023-12-25)
24
+
25
+
26
+ ### ⚠ BREAKING CHANGES
27
+
28
+ * update babel and drop browser modern version
29
+
30
+ ### Features
31
+
32
+ * update babel and drop browser modern version ([5c76abc](https://github.com/christophehurpeau/nightingale/commit/5c76abc8bfb595a617fc4c8b795dae7e674ea664))
33
+
34
+ Version bump for dependency: nightingale-ansi-formatter
35
+ Version bump for dependency: nightingale-console-output
36
+ Version bump for dependency: nightingale-debug
37
+ Version bump for dependency: nightingale-json-formatter
38
+ Version bump for dependency: nightingale-levels
39
+ Version bump for dependency: nightingale-types
40
+
41
+
6
42
  ## [14.2.1](https://github.com/christophehurpeau/nightingale/compare/v14.2.0...v14.2.1) (2023-11-05)
7
43
 
8
44
  Note: no notable changes
package/README.md CHANGED
@@ -1,50 +1,28 @@
1
- <h3 align="center">
1
+ <h1 align="center">
2
2
  nightingale-console
3
- </h3>
3
+ </h1>
4
4
 
5
5
  <p align="center">
6
- Console handler for nightingale
6
+ Deprecated: use ConsoleHandler from nightingale
7
7
  </p>
8
8
 
9
9
  <p align="center">
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>
10
+ <a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/npm/v/nightingale-console.svg?style=flat-square" alt="npm version"></a>
11
+ <a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/npm/dw/nightingale-console.svg?style=flat-square" alt="npm downloads"></a>
12
+ <a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/node/v/nightingale-console.svg?style=flat-square" alt="node version"></a>
13
+ <a href="https://npmjs.org/package/nightingale-console"><img src="https://img.shields.io/npm/types/nightingale-console.svg?style=flat-square" alt="types"></a>
14
14
  </p>
15
15
 
16
16
  ## Install
17
17
 
18
18
  ```sh
19
- npm install --save nightingale nightingale-console
19
+ npm install --save nightingale
20
20
  ```
21
21
 
22
22
  ## Usage
23
23
 
24
24
  ```js
25
- import { configure, levels } from 'nightingale';
26
- import { ConsoleHandler } from 'nightingale-console';
25
+ import { configure, levels, ConsoleHandler } from "nightingale";
27
26
 
28
27
  configure([{ handlers: [new ConsoleHandler(Level.INFO)] }]);
29
28
  ```
30
-
31
- ## Debug
32
-
33
- `DEBUG=* node .`
34
-
35
- ```js
36
- DEBUG='*'; # debug everything
37
- DEBUG=app # debug for logger with key 'app'
38
- DEBUG=app:* # debug for logger with key 'app' and all its children
39
- DEBUG=app,nightingale # debug for logger with key 'app' and 'nightingale'
40
- DEBUG=/^app/ # debug for logger with key starting with 'app'
41
- DEBUG=/^(app|nightingale$)/ # debug for logger with key starting with 'app' and key 'nightingale'
42
- DEBUG='*,-app'; # debug everything except app
43
- DEBUG='*,-app:*'; # debug everything except app and all its children
44
- ```
45
-
46
- ## Use source maps to display error stack trace
47
-
48
- Since node 12.12.0, you can use `--enable-source-maps` while running node.
49
-
50
- ![error with source maps](https://static.hurpeau.com/images/npm/nightingale/screenshot-errors-with-source-maps.png)
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ export { ConsoleHandler } from "nightingale";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nightingale-console",
3
- "version": "14.2.1",
4
- "description": "Console handler for nightingale",
3
+ "version": "16.0.0",
4
+ "description": "Deprecated: use ConsoleHandler from nightingale",
5
5
  "keywords": [
6
6
  "nightingale",
7
7
  "nightingale-handler"
@@ -16,57 +16,27 @@
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
17
  "type": "module",
18
18
  "engines": {
19
- "node": ">=18.12.0"
19
+ "node": ">=20.9.0"
20
20
  },
21
- "main": "./dist/index-node18.mjs",
22
- "types": "./dist/definitions/index.d.ts",
21
+ "sideEffects": false,
22
+ "main": "./lib/index.js",
23
+ "types": "./lib/index.d.ts",
23
24
  "exports": {
24
25
  "./package.json": "./package.json",
25
- ".": {
26
- "types": "./dist/definitions/index.d.ts",
27
- "node": {
28
- "import": "./dist/index-node18.mjs"
29
- }
30
- }
26
+ ".": "./lib/index.js"
31
27
  },
32
- "sideEffects": false,
33
28
  "files": [
34
- "src",
35
- "dist"
29
+ "lib"
36
30
  ],
37
31
  "scripts": {
38
- "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
39
- "build:definitions": "tsc -p tsconfig.json",
40
32
  "clean": "yarn clean:build",
41
- "clean:build": "pob-babel-clean-out dist",
42
33
  "lint": "yarn run lint:eslint",
43
- "lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-console",
34
+ "lint:eslint": "yarn ../.. run eslint --quiet packages/nightingale-console",
44
35
  "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
45
36
  },
37
+ "pob": {},
46
38
  "prettier": "@pob/root/prettier-config",
47
- "pob": {
48
- "babelEnvs": [
49
- {
50
- "target": "node",
51
- "version": "18"
52
- }
53
- ],
54
- "entries": [
55
- "index"
56
- ]
57
- },
58
39
  "dependencies": {
59
- "@types/node": ">=18.0.0",
60
- "nightingale-ansi-formatter": "14.2.1",
61
- "nightingale-console-output": "14.2.1",
62
- "nightingale-debug": "14.2.1",
63
- "nightingale-json-formatter": "14.2.1",
64
- "nightingale-levels": "14.2.1",
65
- "nightingale-types": "14.2.1"
66
- },
67
- "devDependencies": {
68
- "@babel/core": "7.23.2",
69
- "pob-babel": "36.6.1",
70
- "typescript": "5.2.2"
40
+ "nightingale": "16.0.0"
71
41
  }
72
42
  }
@@ -1,14 +0,0 @@
1
- import { Level } from 'nightingale-levels';
2
- import type { IsHandling, Handle, LogRecord, Metadata, Handler } from 'nightingale-types';
3
- export interface ConsoleHandlerOptions {
4
- formatter?: <T extends Metadata>(record: LogRecord<T>) => string;
5
- output?: <T extends Metadata>(param: string[] | string, record: LogRecord<T>) => void;
6
- theme?: 'dark' | 'light';
7
- }
8
- export declare class ConsoleHandler implements Handler {
9
- minLevel: Level;
10
- isHandling: IsHandling;
11
- handle: Handle;
12
- constructor(minLevel: Level, options?: ConsoleHandlerOptions);
13
- }
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,EAAE,GAAG,MAAM,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"}
@@ -1,24 +0,0 @@
1
- import formatterANSI from 'nightingale-ansi-formatter';
2
- import consoleOutput from 'nightingale-console-output';
3
- import { createFindDebugLevel } from 'nightingale-debug';
4
- import formatterJSON from 'nightingale-json-formatter';
5
- import { Level } from 'nightingale-levels';
6
-
7
- const defaultFormatter = !process.stdout.isTTY && process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi' ? formatterJSON : formatterANSI;
8
- const createHandle = (formatter = defaultFormatter, output = consoleOutput) => {
9
- return record => {
10
- output(formatter(record), record);
11
- };
12
- };
13
- const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
14
- class ConsoleHandler {
15
- minLevel = Level.ALL;
16
- constructor(minLevel, options = {}) {
17
- this.minLevel = minLevel;
18
- this.isHandling = (level, key) => level >= findDebugLevel(minLevel, key);
19
- this.handle = createHandle(options.formatter, options.output);
20
- }
21
- }
22
-
23
- export { ConsoleHandler };
24
- //# sourceMappingURL=index-node18.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node18.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,GAAGA,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,WAAWA,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;;;;"}
@@ -1,30 +0,0 @@
1
- {
2
- "root": true,
3
- "parser": "@typescript-eslint/parser",
4
- "parserOptions": {
5
- "project": "packages/nightingale-console/tsconfig.json"
6
- },
7
- "plugins": ["@typescript-eslint"],
8
- "extends": [
9
- "@pob/eslint-config-typescript",
10
- "@pob/eslint-config-typescript/node"
11
- ],
12
- "ignorePatterns": ["*.d.ts"],
13
- "overrides": [
14
- {
15
- "files": ["**/*.test.ts", "__tests__/**/*.ts"],
16
- "extends": ["@pob/eslint-config-typescript/test"],
17
- "env": {
18
- "jest": true
19
- },
20
- "rules": {
21
- "import/no-extraneous-dependencies": [
22
- "error",
23
- {
24
- "devDependencies": true
25
- }
26
- ]
27
- }
28
- }
29
- ]
30
- }
package/src/index.ts DELETED
@@ -1,55 +0,0 @@
1
- import { POB_TARGET } from 'pob-babel';
2
- import formatterANSI from 'nightingale-ansi-formatter';
3
- import consoleOutput from 'nightingale-console-output';
4
- import { createFindDebugLevel } from 'nightingale-debug';
5
- import formatterJSON from 'nightingale-json-formatter';
6
- import { Level } from 'nightingale-levels';
7
- import type {
8
- IsHandling,
9
- Handle,
10
- LogRecord,
11
- Metadata,
12
- Handler,
13
- } from 'nightingale-types';
14
-
15
- const defaultFormatter =
16
- POB_TARGET === 'node' &&
17
- !process.stdout.isTTY &&
18
- process.env.NIGHTINGALE_CONSOLE_FORMATTER !== 'ansi'
19
- ? formatterJSON
20
- : formatterANSI;
21
-
22
- const createHandle = (
23
- formatter = defaultFormatter,
24
- output = consoleOutput,
25
- ): Handle => {
26
- return <T extends Metadata>(record: LogRecord<T>): void => {
27
- output(formatter(record), record);
28
- };
29
- };
30
- const findDebugLevel = createFindDebugLevel(process.env.DEBUG);
31
-
32
- export interface ConsoleHandlerOptions {
33
- formatter?: <T extends Metadata>(record: LogRecord<T>) => string;
34
- output?: <T extends Metadata>(
35
- param: string[] | string,
36
- record: LogRecord<T>,
37
- ) => void;
38
- // compat with nightingale-app-console, not used yet
39
- theme?: 'dark' | 'light';
40
- }
41
-
42
- export class ConsoleHandler implements Handler {
43
- minLevel: Level = Level.ALL;
44
-
45
- isHandling: IsHandling;
46
-
47
- handle: Handle;
48
-
49
- constructor(minLevel: Level, options: ConsoleHandlerOptions = {}) {
50
- this.minLevel = minLevel;
51
- this.isHandling = (level: Level, key: string) =>
52
- level >= findDebugLevel(minLevel, key);
53
- this.handle = createHandle(options.formatter, options.output);
54
- }
55
- }