@stackone/logger 0.1.4

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/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @stackone/logger
2
+
3
+ ## Description
4
+
5
+ This package contains the logger for stackone projects.
6
+
7
+ This package uses the tech stack provided by the **Connect Monorepo** global setup. Please check the [root README](../../README.md) for more information.
8
+
9
+ ## Requirements
10
+
11
+ Please check the [root README](../../README.md) for requirements.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ # install dependencies
17
+ $ npm run install
18
+ ```
19
+
20
+ ## Available commands
21
+
22
+ ```bash
23
+ # clean build output
24
+ $ npm run clean
25
+ ```
26
+
27
+ ```bash
28
+ # build package
29
+ $ npm run build
30
+ ```
31
+
32
+ ```bash
33
+ # run tests
34
+ $ npm run test
35
+ ```
36
+
37
+ ```bash
38
+ # run tests on watch mode
39
+ $ npm run test:watch
40
+ ```
41
+
42
+ ```bash
43
+ # run linter
44
+ $ npm run lint
45
+ ```
46
+
47
+ ```bash
48
+ # run linter and try to fix any error
49
+ $ npm run lint:fix
50
+ ```
@@ -0,0 +1 @@
1
+ var r;!function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warning=3]="Warning",r[r.Error=4]="Error"}(r||(r={}));export{r as LogLevel};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var r;exports.LogLevel=void 0,(r=exports.LogLevel||(exports.LogLevel={}))[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warning=3]="Warning",r[r.Error=4]="Error";
@@ -0,0 +1,2 @@
1
+ export type { ILogger, Log, LogError } from './types';
2
+ export { LogLevel } from './types';
@@ -0,0 +1,53 @@
1
+ export interface ILogger {
2
+ debug({ category, message, traceId, context, }: {
3
+ category?: string;
4
+ message: string;
5
+ traceId?: string;
6
+ context?: Record<string, unknown>;
7
+ }): void;
8
+ info({ category, message, traceId, context, }: {
9
+ category?: string;
10
+ message: string;
11
+ traceId?: string;
12
+ context?: Record<string, unknown>;
13
+ }): void;
14
+ warning({ category, message, traceId, error, code, context, }: {
15
+ category?: string;
16
+ message: string;
17
+ traceId?: string;
18
+ error?: LogError;
19
+ code?: string;
20
+ context?: Record<string, unknown>;
21
+ }): void;
22
+ error({ category, message, traceId, error, code, context, }: {
23
+ category?: string;
24
+ message: string;
25
+ traceId?: string;
26
+ error?: LogError;
27
+ code: string;
28
+ context?: Record<string, unknown>;
29
+ }): void;
30
+ }
31
+ export type LogError = Error & {
32
+ response?: {
33
+ data?: unknown;
34
+ };
35
+ context?: Record<string, unknown>;
36
+ url?: string;
37
+ };
38
+ export declare enum LogLevel {
39
+ Trace = 0,
40
+ Debug = 1,
41
+ Info = 2,
42
+ Warning = 3,
43
+ Error = 4
44
+ }
45
+ export type Log = {
46
+ level: LogLevel;
47
+ category?: string;
48
+ message: string;
49
+ traceId?: string;
50
+ error?: LogError;
51
+ code?: string;
52
+ context?: Record<string, unknown>;
53
+ };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@stackone/logger",
3
+ "version": "0.1.4",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.es.mjs",
7
+ "types": "dist/types/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "package.json",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "clean": "rimraf dist",
15
+ "prebuild": "npm run clean",
16
+ "build": "rollup -c --environment NODE_ENV:production",
17
+ "prebuild:dev": "npm run clean",
18
+ "build:dev": "rollup -c --environment NODE_ENV:development",
19
+ "code:format": "biome format ./src ./*.mjs",
20
+ "code:format:fix": "biome format --write ./src ./*.mjs",
21
+ "code:lint": "biome lint --error-on-warnings ./src ./*.mjs",
22
+ "code:lint:fix": "biome lint --write ./src ./*.mjs",
23
+ "code:check": "biome check ./src ./*.mjs",
24
+ "code:check:fix": "biome check --write ./src ./*.mjs",
25
+ "lint": "npm run code:check",
26
+ "lint:fix": "npm run code:check:fix",
27
+ "test": "FORCE_COLOR=1 vitest run",
28
+ "test:watch": "FORCE_COLOR=1 vitest watch --silent",
29
+ "publish-release": "npm publish --access=public"
30
+ },
31
+ "keywords": [],
32
+ "author": "StackOne",
33
+ "license": "ISC",
34
+ "dependencies": {}
35
+ }