@alistigo/pino-logger-plugin 0.0.0-stage → 0.4.5
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/LICENSE +21 -0
- package/README.md +22 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +52 -0
- package/package.json +48 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mikael Labrut
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @alistigo/logger
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@alistigo/logger)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://github.com/alistigo/holos/actions/workflows/ci.yml)
|
|
7
|
+
|
|
8
|
+
Shared pino-based logger for Alistigo apps and packages. Wraps pino with a singleton root logger and a `createLogger` factory for named child loggers.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pnpm add @alistigo/logger
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createLogger } from "@alistigo/logger";
|
|
20
|
+
|
|
21
|
+
const logger = createLogger("my-module");
|
|
22
|
+
logger.info("hello");
|
|
23
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LoggerPlugin } from "@alistigo/artifact-plugin-api";
|
|
2
|
+
import type { LevelWithSilent } from "pino";
|
|
3
|
+
import pino from "pino";
|
|
4
|
+
export type { LevelWithSilent };
|
|
5
|
+
declare const root: pino.Logger<never, boolean>;
|
|
6
|
+
export declare const setLogLevel: (level: LevelWithSilent) => void;
|
|
7
|
+
/** Creates a pino child logger. For application/infrastructure use only — domain/presentation layers should use createLogger from @alistigo/artifact-plugin-api instead. */
|
|
8
|
+
export declare const createLogger: (module: string, ctx?: Record<string, unknown>) => ReturnType<typeof root.child>;
|
|
9
|
+
export declare const pinoLoggerPlugin: LoggerPlugin;
|
|
10
|
+
export default pinoLoggerPlugin;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,QAAA,MAAM,IAAI,6BAGR,CAAC;AAEH,eAAO,MAAM,WAAW,GAAI,OAAO,eAAe,KAAG,IAEpD,CAAC;AAEF,4KAA4K;AAC5K,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,EACd,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,CAAmC,CAAC;AAInE,eAAO,MAAM,gBAAgB,EAAE,YAQ9B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import pino from "pino";
|
|
2
|
+
const root = pino({
|
|
3
|
+
level: "silent",
|
|
4
|
+
browser: { asObject: true },
|
|
5
|
+
});
|
|
6
|
+
export const setLogLevel = (level) => {
|
|
7
|
+
root.level = level;
|
|
8
|
+
};
|
|
9
|
+
/** Creates a pino child logger. For application/infrastructure use only — domain/presentation layers should use createLogger from @alistigo/artifact-plugin-api instead. */
|
|
10
|
+
export const createLogger = (module, ctx) => root.child({ module, ...ctx });
|
|
11
|
+
const pinoCreateLogger = createLogger;
|
|
12
|
+
export const pinoLoggerPlugin = {
|
|
13
|
+
name: "@alistigo/pino-logger-plugin",
|
|
14
|
+
type: "logger",
|
|
15
|
+
setup(ctx) {
|
|
16
|
+
ctx.on("log:emitted", ({ level, module, message, data }) => {
|
|
17
|
+
pinoCreateLogger(module)[level](data ?? {}, message);
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default pinoLoggerPlugin;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAQ,EAAE;IAC1D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAEF,4KAA4K;AAC5K,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,GAA6B,EACE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;AAEnE,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,GAAG;QACP,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;YACzD,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alistigo/pino-logger-plugin",
|
|
3
|
+
"version": "0.4.5",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Mikael Labrut",
|
|
7
|
+
"email": "contact@alistigo.com"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/alistigo/holos.git",
|
|
12
|
+
"directory": "packages/logger"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/alistigo/holos/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/alistigo/holos/tree/main/packages/logger#readme",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"alistigo",
|
|
20
|
+
"logger",
|
|
21
|
+
"pino",
|
|
22
|
+
"typescript"
|
|
23
|
+
],
|
|
24
|
+
"private": false,
|
|
25
|
+
"type": "module",
|
|
26
|
+
"description": "Pino-backed logger plugin for Alistigo. Subscribes to log:emitted bus events and routes them to Pino. Also exports setLogLevel for startup configuration.",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"alistigo": {
|
|
42
|
+
"type": "plugin"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@alistigo/artifact-plugin-api": "workspace:*",
|
|
46
|
+
"pino": "^9.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^22.0.0"
|
|
50
|
+
},
|
|
51
|
+
"module": "./index.js"
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alistigo/pino-logger-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.4.5",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Mikael Labrut",
|
|
7
|
+
"email": "contact@alistigo.com"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/alistigo/holos.git",
|
|
12
|
+
"directory": "packages/logger"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/alistigo/holos/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/alistigo/holos/tree/main/packages/logger#readme",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"alistigo",
|
|
20
|
+
"logger",
|
|
21
|
+
"pino",
|
|
22
|
+
"typescript"
|
|
23
|
+
],
|
|
24
|
+
"private": false,
|
|
25
|
+
"type": "module",
|
|
26
|
+
"description": "Pino-backed logger plugin for Alistigo. Subscribes to log:emitted bus events and routes them to Pino. Also exports setLogLevel for startup configuration.",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"alistigo": {
|
|
42
|
+
"type": "plugin"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"pino": "^9.0.0",
|
|
46
|
+
"@alistigo/artifact-plugin-api": "0.6.5"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^22.0.0"
|
|
50
|
+
}
|
|
6
51
|
}
|