@reliverse/relinka 1.3.3 → 1.3.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/bin/libs/core/core-impl/deprecated/components/core/core.d.ts +1 -0
- package/bin/libs/core/core-impl/deprecated/components/core/core.js +1 -0
- package/bin/libs/core/core-impl/deprecated/components/levels/levels.d.ts +26 -0
- package/bin/{deprecated → libs/core/core-impl/deprecated}/components/levels/levels.js +15 -15
- package/bin/libs/core/core-impl/deprecated/components/modes/basic.d.ts +20 -0
- package/bin/libs/core/core-impl/deprecated/components/modes/basic.js +21 -0
- package/bin/{deprecated → libs/core/core-impl/deprecated}/components/modes/browser.d.ts +5 -5
- package/bin/libs/core/core-impl/deprecated/components/modes/browser.js +12 -0
- package/bin/libs/core/core-impl/deprecated/components/modes/shared.d.ts +3 -0
- package/bin/libs/core/core-impl/deprecated/components/modes/shared.js +4 -0
- package/bin/{deprecated/components/relinka → libs/core/core-impl/deprecated/components/relinka-deprecated}/logger.d.ts +1 -1
- package/bin/libs/core/core-impl/deprecated/components/relinka-deprecated/logger.js +5 -0
- package/bin/{deprecated/components/relinka → libs/core/core-impl/deprecated/components/relinka-deprecated}/mod.d.ts +7 -7
- package/bin/{deprecated/components/relinka → libs/core/core-impl/deprecated/components/relinka-deprecated}/mod.js +11 -11
- package/bin/{deprecated/components/relinka → libs/core/core-impl/deprecated/components/relinka-deprecated}/relinka.d.ts +11 -11
- package/bin/{deprecated/components/relinka → libs/core/core-impl/deprecated/components/relinka-deprecated}/relinka.js +19 -19
- package/bin/{deprecated → libs/core/core-impl/deprecated}/components/reporters/browser.d.ts +1 -1
- package/bin/libs/core/core-impl/deprecated/components/reporters/fancy.d.ts +10 -0
- package/bin/{deprecated → libs/core/core-impl/deprecated}/components/reporters/fancy.js +3 -1
- package/bin/{deprecated → libs/core/core-impl/deprecated}/types/mod.d.ts +15 -15
- package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/deprecatedColors.d.ts +1 -1
- package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/deprecatedColors.js +2 -5
- package/bin/libs/core/core-main.d.ts +23 -0
- package/bin/libs/core/core-main.js +49 -0
- package/bin/main.d.ts +1 -1
- package/bin/main.js +1 -1
- package/package.json +2 -1
- package/bin/deprecated/components/core/core.d.ts +0 -2
- package/bin/deprecated/components/core/core.js +0 -2
- package/bin/deprecated/components/levels/levels.d.ts +0 -26
- package/bin/deprecated/components/modes/basic.d.ts +0 -20
- package/bin/deprecated/components/modes/basic.js +0 -21
- package/bin/deprecated/components/modes/browser.js +0 -12
- package/bin/deprecated/components/modes/shared.d.ts +0 -5
- package/bin/deprecated/components/modes/shared.js +0 -2
- package/bin/deprecated/components/relinka/logger.js +0 -5
- package/bin/deprecated/components/reporters/fancy.d.ts +0 -10
- package/bin/deprecated/depd-main.d.ts +0 -2
- package/bin/deprecated/depd-main.js +0 -2
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/components/reporters/basic.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/components/reporters/basic.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/components/reporters/browser.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/types/mod.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/box.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/box.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/error.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/error.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/format.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/format.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/log.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/log.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/mod.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/mod.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/stream.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/stream.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/string.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/string.js +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/tree.d.ts +0 -0
- /package/bin/{deprecated → libs/core/core-impl/deprecated}/utils/tree.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../modes/shared.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../modes/shared.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LogObject } from "../../types/mod.js";
|
|
2
|
+
/**
|
|
3
|
+
* Defines the level of logs as specific numbers or special number types.
|
|
4
|
+
*
|
|
5
|
+
* @type {0 | 1 | 2 | 3 | 4 | 5 | (number & {})} LogLevelDeprecated - Represents the log level.
|
|
6
|
+
* @default 0 - Represents the default log level.
|
|
7
|
+
*/
|
|
8
|
+
export type LogLevelDeprecated = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
|
|
9
|
+
/**
|
|
10
|
+
* A mapping of `LogTypeDeprecated` to its corresponding numeric log level.
|
|
11
|
+
*
|
|
12
|
+
* @type {Record<LogTypeDeprecated, number>} LogLevelsDeprecated - key-value pairs of log types to their numeric levels. See {@link LogTypeDeprecated}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LogLevelsDeprecated: Record<LogTypeDeprecated, number>;
|
|
15
|
+
/**
|
|
16
|
+
* Lists the types of log messages supported by the system.
|
|
17
|
+
*
|
|
18
|
+
* @type {"silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose"} LogTypeDeprecated - Represents the specific type of log message.
|
|
19
|
+
*/
|
|
20
|
+
export type LogTypeDeprecated = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
|
|
21
|
+
/**
|
|
22
|
+
* Maps `LogTypeDeprecated` to a `Partial<LogObject>`, primarily defining the log level.
|
|
23
|
+
*
|
|
24
|
+
* @type {Record<LogTypeDeprecated, Partial<LogObject>>} LogTypesDeprecated - key-value pairs of log types to partial log objects, specifying log levels. See {@link LogTypeDeprecated} and {@link LogObject}.
|
|
25
|
+
*/
|
|
26
|
+
export declare const LogTypesDeprecated: Record<LogTypeDeprecated, Partial<LogObject>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const LogLevelsDeprecated = {
|
|
2
2
|
silent: Number.NEGATIVE_INFINITY,
|
|
3
3
|
fatal: 0,
|
|
4
4
|
error: 0,
|
|
@@ -14,55 +14,55 @@ export const LogLevels = {
|
|
|
14
14
|
trace: 5,
|
|
15
15
|
verbose: Number.POSITIVE_INFINITY
|
|
16
16
|
};
|
|
17
|
-
export const
|
|
17
|
+
export const LogTypesDeprecated = {
|
|
18
18
|
// Silent
|
|
19
19
|
silent: {
|
|
20
20
|
level: -1
|
|
21
21
|
},
|
|
22
22
|
// Level 0
|
|
23
23
|
fatal: {
|
|
24
|
-
level:
|
|
24
|
+
level: LogLevelsDeprecated.fatal
|
|
25
25
|
},
|
|
26
26
|
error: {
|
|
27
|
-
level:
|
|
27
|
+
level: LogLevelsDeprecated.error
|
|
28
28
|
},
|
|
29
29
|
// Level 1
|
|
30
30
|
warn: {
|
|
31
|
-
level:
|
|
31
|
+
level: LogLevelsDeprecated.warn
|
|
32
32
|
},
|
|
33
33
|
// Level 2
|
|
34
34
|
log: {
|
|
35
|
-
level:
|
|
35
|
+
level: LogLevelsDeprecated.log
|
|
36
36
|
},
|
|
37
37
|
// Level 3
|
|
38
38
|
info: {
|
|
39
|
-
level:
|
|
39
|
+
level: LogLevelsDeprecated.info
|
|
40
40
|
},
|
|
41
41
|
success: {
|
|
42
|
-
level:
|
|
42
|
+
level: LogLevelsDeprecated.success
|
|
43
43
|
},
|
|
44
44
|
fail: {
|
|
45
|
-
level:
|
|
45
|
+
level: LogLevelsDeprecated.fail
|
|
46
46
|
},
|
|
47
47
|
ready: {
|
|
48
|
-
level:
|
|
48
|
+
level: LogLevelsDeprecated.info
|
|
49
49
|
},
|
|
50
50
|
start: {
|
|
51
|
-
level:
|
|
51
|
+
level: LogLevelsDeprecated.info
|
|
52
52
|
},
|
|
53
53
|
box: {
|
|
54
|
-
level:
|
|
54
|
+
level: LogLevelsDeprecated.info
|
|
55
55
|
},
|
|
56
56
|
// Level 4
|
|
57
57
|
debug: {
|
|
58
|
-
level:
|
|
58
|
+
level: LogLevelsDeprecated.debug
|
|
59
59
|
},
|
|
60
60
|
// Level 5
|
|
61
61
|
trace: {
|
|
62
|
-
level:
|
|
62
|
+
level: LogLevelsDeprecated.trace
|
|
63
63
|
},
|
|
64
64
|
// Verbose
|
|
65
65
|
verbose: {
|
|
66
|
-
level:
|
|
66
|
+
level: LogLevelsDeprecated.verbose
|
|
67
67
|
}
|
|
68
68
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RelinkaInstanceDeprecated } from "../relinka-deprecated/relinka.js";
|
|
2
|
+
import type { RelinkaOptions } from "../../types/mod.js";
|
|
3
|
+
export * from "./shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Factory function to create a new Relinka instance
|
|
6
|
+
*
|
|
7
|
+
* @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
|
|
8
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance configured with the given options.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createRelinkaBaseDeprecated(options?: Partial<RelinkaOptions & {
|
|
11
|
+
fancy: boolean;
|
|
12
|
+
}>): RelinkaInstanceDeprecated;
|
|
13
|
+
/**
|
|
14
|
+
* Creates and exports a standard instance of Relinka with the default configuration.
|
|
15
|
+
* This instance can be used directly for logging throughout the application.
|
|
16
|
+
*
|
|
17
|
+
* @type {RelinkaInstanceDeprecated} relinka - The default instance of Relinka.
|
|
18
|
+
*/
|
|
19
|
+
export declare const relinkaBasicDeprecated: RelinkaInstanceDeprecated;
|
|
20
|
+
export default relinkaBasicDeprecated;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LogLevelsDeprecated } from "../levels/levels.js";
|
|
2
|
+
import { createRelinkaDeprecated as _createRelinkaDeprecated } from "../relinka-deprecated/relinka.js";
|
|
3
|
+
import { BasicReporter } from "../reporters/basic.js";
|
|
4
|
+
export * from "./shared.js";
|
|
5
|
+
export function createRelinkaBaseDeprecated(options = {}) {
|
|
6
|
+
let level = LogLevelsDeprecated.info;
|
|
7
|
+
if (process.env.RELINKA_LEVEL) {
|
|
8
|
+
level = Number.parseInt(process.env.RELINKA_LEVEL) ?? level;
|
|
9
|
+
}
|
|
10
|
+
const relinka = _createRelinkaDeprecated({
|
|
11
|
+
level,
|
|
12
|
+
defaults: { level },
|
|
13
|
+
stdout: process.stdout,
|
|
14
|
+
stderr: process.stderr,
|
|
15
|
+
reporters: options.reporters || [new BasicReporter()],
|
|
16
|
+
...options
|
|
17
|
+
});
|
|
18
|
+
return relinka;
|
|
19
|
+
}
|
|
20
|
+
export const relinkaBasicDeprecated = createRelinkaBaseDeprecated();
|
|
21
|
+
export default relinkaBasicDeprecated;
|
|
@@ -6,14 +6,14 @@ export * from "./shared.js";
|
|
|
6
6
|
*
|
|
7
7
|
* @param {Partial<RelinkaOptions>} [options={}] - Optional configuration options.
|
|
8
8
|
* The options can override the default reporter and prompt behavior. See {@link RelinkaOptions}.
|
|
9
|
-
* @returns {
|
|
9
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance optimized for use in browser environments.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function createRelinkaBrowserDeprecatedDeprecated(options?: Partial<RelinkaOptions>): any;
|
|
12
12
|
/**
|
|
13
13
|
* A standard Relinka instance created with browser-specific configurations.
|
|
14
14
|
* This instance can be used throughout a browser-based project.
|
|
15
15
|
*
|
|
16
|
-
* @type {
|
|
16
|
+
* @type {RelinkaInstanceDeprecated} relinka - The default browser-configured Relinka instance.
|
|
17
17
|
*/
|
|
18
|
-
export declare const
|
|
19
|
-
export default
|
|
18
|
+
export declare const relinkaBrowserDeprecated: any;
|
|
19
|
+
export default relinkaBrowserDeprecated;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRelinkaDeprecated as _createRelinkaDeprecated } from "../relinka-deprecated/relinka.js";
|
|
2
|
+
import { BrowserReporter } from "../reporters/browser.js";
|
|
3
|
+
export * from "./shared.js";
|
|
4
|
+
export function createRelinkaBrowserDeprecatedDeprecated(options = {}) {
|
|
5
|
+
const relinka = _createRelinkaDeprecated({
|
|
6
|
+
reporters: options.reporters || [new BrowserReporter({})],
|
|
7
|
+
...options
|
|
8
|
+
});
|
|
9
|
+
return relinka;
|
|
10
|
+
}
|
|
11
|
+
export const relinkaBrowserDeprecated = createRelinkaBrowserDeprecatedDeprecated();
|
|
12
|
+
export default relinkaBrowserDeprecated;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type MessageKind = "log" | "info" | "warn" | "error" | "success";
|
|
2
2
|
type VerboseKind = `${MessageKind}-verbose`;
|
|
3
3
|
type AllKinds = MessageKind | VerboseKind;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const relinkaDeprecated: (_kind: AllKinds, title: string, content?: string, hint?: string) => void;
|
|
5
5
|
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { RelinkaOptions } from "../../types/mod.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RelinkaInstanceDeprecated } from "./relinka.js";
|
|
3
3
|
export * from "../modes/shared.js";
|
|
4
4
|
/**
|
|
5
5
|
* Factory function to create a new Relinka instance tailored for use in different environments.
|
|
6
6
|
* It automatically adjusts logging levels based on environment variables and execution context.
|
|
7
7
|
*
|
|
8
8
|
* @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
|
|
9
|
-
* @returns {
|
|
9
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance with configurations based on the given options and the execution environment.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function createRelinkaSharedDeprecated(options?: Partial<RelinkaOptions & {
|
|
12
12
|
fancy: boolean;
|
|
13
|
-
}>):
|
|
13
|
+
}>): RelinkaInstanceDeprecated;
|
|
14
14
|
/**
|
|
15
15
|
* A default instance of Relinka, created and configured for immediate use.
|
|
16
16
|
* This instance is configured based on the execution environment and the options provided.
|
|
17
17
|
*
|
|
18
|
-
* @type {
|
|
18
|
+
* @type {RelinkaInstanceDeprecated} relinka - The default Relinka instance, ready to use.
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
21
|
-
export default
|
|
20
|
+
export declare const relinkaInstanceDeprecated: RelinkaInstanceDeprecated;
|
|
21
|
+
export default relinkaInstanceDeprecated;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { isDebug, isTest, isCI } from "std-env";
|
|
2
|
-
import {
|
|
2
|
+
import { LogLevelsDeprecated } from "../levels/levels.js";
|
|
3
3
|
import { BasicReporter } from "../reporters/basic.js";
|
|
4
4
|
import { FancyReporter } from "../reporters/fancy.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createRelinkaDeprecated as _createRelinkaDeprecated } from "./relinka.js";
|
|
6
6
|
export * from "../modes/shared.js";
|
|
7
|
-
export function
|
|
8
|
-
let level =
|
|
7
|
+
export function createRelinkaSharedDeprecated(options = {}) {
|
|
8
|
+
let level = _getDefaultLogLevelDeprecated();
|
|
9
9
|
if (process.env.RELINKA_LEVEL) {
|
|
10
10
|
level = Number.parseInt(process.env.RELINKA_LEVEL) ?? level;
|
|
11
11
|
}
|
|
12
|
-
const relinka =
|
|
12
|
+
const relinka = _createRelinkaDeprecated({
|
|
13
13
|
level,
|
|
14
14
|
defaults: { level },
|
|
15
15
|
stdout: process.stdout,
|
|
@@ -21,14 +21,14 @@ export function createRelinka(options = {}) {
|
|
|
21
21
|
});
|
|
22
22
|
return relinka;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function _getDefaultLogLevelDeprecated() {
|
|
25
25
|
if (isDebug) {
|
|
26
|
-
return
|
|
26
|
+
return LogLevelsDeprecated.debug;
|
|
27
27
|
}
|
|
28
28
|
if (isTest) {
|
|
29
|
-
return
|
|
29
|
+
return LogLevelsDeprecated.warn;
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return LogLevelsDeprecated.info;
|
|
32
32
|
}
|
|
33
|
-
export const
|
|
34
|
-
export default
|
|
33
|
+
export const relinkaInstanceDeprecated = createRelinkaSharedDeprecated();
|
|
34
|
+
export default relinkaInstanceDeprecated;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import type { LogTypeDeprecated } from "../levels/levels.js";
|
|
2
3
|
import type { InputLogObject, LogObject, RelinkaOptions, RelinkaReporter } from "../../types/mod.js";
|
|
3
|
-
import { type LogType } from "../levels/levels.js";
|
|
4
4
|
/**
|
|
5
5
|
* Relinka class for logging management with support for pause/resume, mocking and customizable reporting.
|
|
6
6
|
* Provides flexible logging capabilities including level-based logging, custom reporters and integration options.
|
|
@@ -41,23 +41,23 @@ export declare class RelinkaInterface {
|
|
|
41
41
|
* Creates a new instance of Relinka, inheriting options from the current instance, with possible overrides.
|
|
42
42
|
*
|
|
43
43
|
* @param {Partial<RelinkaOptions>} options - Optional overrides for the new instance. See {@link RelinkaOptions}.
|
|
44
|
-
* @returns {
|
|
44
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
45
45
|
*/
|
|
46
|
-
create(options: Partial<RelinkaOptions>):
|
|
46
|
+
create(options: Partial<RelinkaOptions>): RelinkaInstanceDeprecated;
|
|
47
47
|
/**
|
|
48
48
|
* Creates a new Relinka instance with the specified default log object properties.
|
|
49
49
|
*
|
|
50
50
|
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
51
|
-
* @returns {
|
|
51
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
52
52
|
*/
|
|
53
|
-
withDefaults(defaults: InputLogObject):
|
|
53
|
+
withDefaults(defaults: InputLogObject): RelinkaInstanceDeprecated;
|
|
54
54
|
/**
|
|
55
55
|
* Creates a new Relinka instance with a specified tag, which will be included in every log.
|
|
56
56
|
*
|
|
57
57
|
* @param {string} tag - The tag to include in each log of the new instance.
|
|
58
|
-
* @returns {
|
|
58
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
59
59
|
*/
|
|
60
|
-
withTag(tag: string):
|
|
60
|
+
withTag(tag: string): RelinkaInstanceDeprecated;
|
|
61
61
|
/**
|
|
62
62
|
* Adds a custom reporter to the Relinka instance.
|
|
63
63
|
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
@@ -95,7 +95,7 @@ export declare class RelinkaInterface {
|
|
|
95
95
|
* Overrides standard output and error streams to redirect them through RelinkaInterface.
|
|
96
96
|
*/
|
|
97
97
|
wrapStd(): void;
|
|
98
|
-
_wrapStream(stream: NodeJS.WriteStream | undefined, type:
|
|
98
|
+
_wrapStream(stream: NodeJS.WriteStream | undefined, type: LogTypeDeprecated): void;
|
|
99
99
|
/**
|
|
100
100
|
* Restores the original standard output and error streams, removing the Relinka redirection.
|
|
101
101
|
*/
|
|
@@ -131,11 +131,11 @@ export type LogFn = {
|
|
|
131
131
|
(message: InputLogObject | any, ...args: any[]): void;
|
|
132
132
|
raw: (...args: any[]) => void;
|
|
133
133
|
};
|
|
134
|
-
export type
|
|
134
|
+
export type RelinkaInstanceDeprecated = RelinkaInterface & Record<LogTypeDeprecated, LogFn>;
|
|
135
135
|
/**
|
|
136
136
|
* Utility for creating a new Relinka instance with optional configuration.
|
|
137
137
|
*
|
|
138
138
|
* @param {Partial<RelinkaOptions>} [options={}] - Optional configuration options for the new Relinka instance. See {@link RelinkaOptions}.
|
|
139
|
-
* @returns {
|
|
139
|
+
* @returns {RelinkaInstanceDeprecated} A new instance of RelinkaInterface. See {@link RelinkaInstanceDeprecated}.
|
|
140
140
|
*/
|
|
141
|
-
export declare function
|
|
141
|
+
export declare function createRelinkaDeprecated(options?: Partial<RelinkaOptions>): RelinkaInstanceDeprecated;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
|
-
import {
|
|
3
|
-
LogTypes
|
|
4
|
-
} from "../levels/levels.js";
|
|
2
|
+
import { LogTypesDeprecated } from "../modes/shared.js";
|
|
5
3
|
import { isLogObj } from "../../utils/log.js";
|
|
6
4
|
export class RelinkaInterface {
|
|
7
5
|
options;
|
|
@@ -16,16 +14,16 @@ export class RelinkaInterface {
|
|
|
16
14
|
* @param {Partial<RelinkaOptions>} [options={}] - Configuration options for the Relinka instance.
|
|
17
15
|
*/
|
|
18
16
|
constructor(options = {}) {
|
|
19
|
-
const types = options.types ||
|
|
17
|
+
const types = options.types || LogTypesDeprecated;
|
|
20
18
|
this.options = defu(
|
|
21
19
|
{
|
|
22
20
|
...options,
|
|
23
21
|
defaults: { ...options.defaults },
|
|
24
|
-
level:
|
|
22
|
+
level: _normalizeLogLevelDeprecated(options.level, types),
|
|
25
23
|
reporters: [...options.reporters || []]
|
|
26
24
|
},
|
|
27
25
|
{
|
|
28
|
-
types:
|
|
26
|
+
types: LogTypesDeprecated,
|
|
29
27
|
throttle: 1e3,
|
|
30
28
|
throttleMin: 5,
|
|
31
29
|
formatOptions: {
|
|
@@ -42,10 +40,7 @@ export class RelinkaInterface {
|
|
|
42
40
|
...types[type]
|
|
43
41
|
};
|
|
44
42
|
this[type] = this._wrapLogFn(defaults);
|
|
45
|
-
this[type].raw = this._wrapLogFn(
|
|
46
|
-
defaults,
|
|
47
|
-
true
|
|
48
|
-
);
|
|
43
|
+
this[type].raw = this._wrapLogFn(defaults, true);
|
|
49
44
|
}
|
|
50
45
|
if (this.options.mockFn) {
|
|
51
46
|
this.mockTypes();
|
|
@@ -68,7 +63,7 @@ export class RelinkaInterface {
|
|
|
68
63
|
* @param {number} level - The new log level to set.
|
|
69
64
|
*/
|
|
70
65
|
set level(level) {
|
|
71
|
-
this.options.level =
|
|
66
|
+
this.options.level = _normalizeLogLevelDeprecated(
|
|
72
67
|
level,
|
|
73
68
|
this.options.types,
|
|
74
69
|
this.options.level
|
|
@@ -78,7 +73,7 @@ export class RelinkaInterface {
|
|
|
78
73
|
* Creates a new instance of Relinka, inheriting options from the current instance, with possible overrides.
|
|
79
74
|
*
|
|
80
75
|
* @param {Partial<RelinkaOptions>} options - Optional overrides for the new instance. See {@link RelinkaOptions}.
|
|
81
|
-
* @returns {
|
|
76
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
82
77
|
*/
|
|
83
78
|
create(options) {
|
|
84
79
|
const instance = new RelinkaInterface({
|
|
@@ -94,7 +89,7 @@ export class RelinkaInterface {
|
|
|
94
89
|
* Creates a new Relinka instance with the specified default log object properties.
|
|
95
90
|
*
|
|
96
91
|
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
97
|
-
* @returns {
|
|
92
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
98
93
|
*/
|
|
99
94
|
withDefaults(defaults) {
|
|
100
95
|
return this.create({
|
|
@@ -109,7 +104,7 @@ export class RelinkaInterface {
|
|
|
109
104
|
* Creates a new Relinka instance with a specified tag, which will be included in every log.
|
|
110
105
|
*
|
|
111
106
|
* @param {string} tag - The tag to include in each log of the new instance.
|
|
112
|
-
* @returns {
|
|
107
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
113
108
|
*/
|
|
114
109
|
withTag(tag) {
|
|
115
110
|
return this.withDefaults({
|
|
@@ -200,7 +195,9 @@ export class RelinkaInterface {
|
|
|
200
195
|
stream.__write = stream.write;
|
|
201
196
|
}
|
|
202
197
|
stream.write = (data) => {
|
|
203
|
-
this[type].raw(
|
|
198
|
+
this[type].raw(
|
|
199
|
+
String(data).trim()
|
|
200
|
+
);
|
|
204
201
|
};
|
|
205
202
|
}
|
|
206
203
|
/**
|
|
@@ -262,7 +259,10 @@ export class RelinkaInterface {
|
|
|
262
259
|
return;
|
|
263
260
|
}
|
|
264
261
|
for (const type in this.options.types) {
|
|
265
|
-
this[type] = _mockFn(
|
|
262
|
+
this[type] = _mockFn(
|
|
263
|
+
type,
|
|
264
|
+
this.options.types[type]
|
|
265
|
+
) || this[type];
|
|
266
266
|
this[type].raw = this[type];
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -284,7 +284,7 @@ export class RelinkaInterface {
|
|
|
284
284
|
date: /* @__PURE__ */ new Date(),
|
|
285
285
|
args: [],
|
|
286
286
|
...defaults,
|
|
287
|
-
level:
|
|
287
|
+
level: _normalizeLogLevelDeprecated(defaults.level, this.options.types)
|
|
288
288
|
};
|
|
289
289
|
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
290
290
|
Object.assign(logObj, args[0]);
|
|
@@ -357,7 +357,7 @@ ${logObj.additional.join("\n")}`);
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function _normalizeLogLevelDeprecated(input, types = {}, defaultLevel = 3) {
|
|
361
361
|
if (input === void 0) {
|
|
362
362
|
return defaultLevel;
|
|
363
363
|
}
|
|
@@ -376,6 +376,6 @@ RelinkaInterface.prototype.withScope = RelinkaInterface.prototype.withTag;
|
|
|
376
376
|
RelinkaInterface.prototype.mock = RelinkaInterface.prototype.mockTypes;
|
|
377
377
|
RelinkaInterface.prototype.pause = RelinkaInterface.prototype.pauseLogs;
|
|
378
378
|
RelinkaInterface.prototype.resume = RelinkaInterface.prototype.resumeLogs;
|
|
379
|
-
export function
|
|
379
|
+
export function createRelinkaDeprecated(options = {}) {
|
|
380
380
|
return new RelinkaInterface(options);
|
|
381
381
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LogLevelDeprecated, LogTypeDeprecated } from "../levels/levels.js";
|
|
2
|
+
import type { FormatOptions, LogObject } from "../../types/mod.js";
|
|
3
|
+
import { BasicReporter } from "./basic.js";
|
|
4
|
+
export declare const TYPE_COLOR_MAP: Partial<Record<LogTypeDeprecated, string>>;
|
|
5
|
+
export declare const LEVEL_COLOR_MAP: Partial<Record<LogLevelDeprecated, string>>;
|
|
6
|
+
export declare class FancyReporter extends BasicReporter {
|
|
7
|
+
formatStack(stack: string): string;
|
|
8
|
+
formatType(logObj: LogObject, isBadge: boolean): any;
|
|
9
|
+
formatLogObj(logObj: LogObject, opts: FormatOptions): any;
|
|
10
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isUnicodeSupported } from "@reliverse/runtime";
|
|
2
2
|
import stringWidth from "string-width";
|
|
3
3
|
import { BasicReporter } from "./basic.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
box
|
|
6
|
+
} from "../../utils/box.js";
|
|
5
7
|
import { colors } from "../../utils/deprecatedColors.js";
|
|
6
8
|
import { parseStack } from "../../utils/error.js";
|
|
7
9
|
import { stripAnsi } from "../../utils/string.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { LogLevelDeprecated, LogTypeDeprecated } from "../components/levels/levels.js";
|
|
3
3
|
export type RelinkaOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* An array of RelinkaReporter instances used to handle and output log messages.
|
|
6
6
|
*/
|
|
7
7
|
reporters: RelinkaReporter[];
|
|
8
8
|
/**
|
|
9
|
-
* A record mapping
|
|
10
|
-
* See {@link
|
|
9
|
+
* A record mapping LogTypeDeprecated to InputLogObject, defining the log configuration for each log type.
|
|
10
|
+
* See {@link LogTypeDeprecated} and {@link InputLogObject}.
|
|
11
11
|
*/
|
|
12
|
-
types: Record<
|
|
12
|
+
types: Record<LogTypeDeprecated, InputLogObject>;
|
|
13
13
|
/**
|
|
14
|
-
* The minimum log level to output. See {@link
|
|
14
|
+
* The minimum log level to output. See {@link LogLevelDeprecated}.
|
|
15
15
|
*/
|
|
16
|
-
level:
|
|
16
|
+
level: LogLevelDeprecated;
|
|
17
17
|
/**
|
|
18
18
|
* Default properties applied to all log messages unless overridden. See {@link InputLogObject}.
|
|
19
19
|
*/
|
|
@@ -40,7 +40,7 @@ export type RelinkaOptions = {
|
|
|
40
40
|
* A function that allows you to mock log messages for testing purposes.
|
|
41
41
|
* @optional
|
|
42
42
|
*/
|
|
43
|
-
mockFn?: (type:
|
|
43
|
+
mockFn?: (type: LogTypeDeprecated, defaults: InputLogObject) => (...args: any) => void;
|
|
44
44
|
/**
|
|
45
45
|
* Configuration options for formatting log messages. See {@link FormatOptions}.
|
|
46
46
|
*/
|
|
@@ -77,20 +77,20 @@ export type FormatOptions = {
|
|
|
77
77
|
};
|
|
78
78
|
export type InputLogObject = {
|
|
79
79
|
/**
|
|
80
|
-
* The logging level of the message. See {@link
|
|
80
|
+
* The logging level of the message. See {@link LogLevelDeprecated}.
|
|
81
81
|
* @optional
|
|
82
82
|
*/
|
|
83
|
-
level?:
|
|
83
|
+
level?: LogLevelDeprecated;
|
|
84
84
|
/**
|
|
85
85
|
* A string tag to categorize or identify the log message.
|
|
86
86
|
* @optional
|
|
87
87
|
*/
|
|
88
88
|
tag?: string;
|
|
89
89
|
/**
|
|
90
|
-
* The type of log message, which affects how it's processed and displayed. See {@link
|
|
90
|
+
* The type of log message, which affects how it's processed and displayed. See {@link LogTypeDeprecated}.
|
|
91
91
|
* @optional
|
|
92
92
|
*/
|
|
93
|
-
type?:
|
|
93
|
+
type?: LogTypeDeprecated;
|
|
94
94
|
/**
|
|
95
95
|
* The main log message text.
|
|
96
96
|
* @optional
|
|
@@ -114,13 +114,13 @@ export type InputLogObject = {
|
|
|
114
114
|
};
|
|
115
115
|
export type LogObject = {
|
|
116
116
|
/**
|
|
117
|
-
* The logging level of the message, overridden if required. See {@link
|
|
117
|
+
* The logging level of the message, overridden if required. See {@link LogLevelDeprecated}.
|
|
118
118
|
*/
|
|
119
|
-
level:
|
|
119
|
+
level: LogLevelDeprecated;
|
|
120
120
|
/**
|
|
121
|
-
* The type of log message, overridden if required. See {@link
|
|
121
|
+
* The type of log message, overridden if required. See {@link LogTypeDeprecated}.
|
|
122
122
|
*/
|
|
123
|
-
type:
|
|
123
|
+
type: LogTypeDeprecated;
|
|
124
124
|
/**
|
|
125
125
|
* A string tag to categorize or identify the log message, overridden if necessary.
|
|
126
126
|
*/
|
|
@@ -51,7 +51,7 @@ export type ColorFunction = (text: string | number) => string;
|
|
|
51
51
|
/**
|
|
52
52
|
* An object containing functions for coloring text. Each function corresponds to a terminal color. See {@link ColorName} for available colors.
|
|
53
53
|
*/
|
|
54
|
-
export declare const colors: Record<"bold" | "
|
|
54
|
+
export declare const colors: Record<"bold" | "cyan" | "red" | "green" | "magenta" | "yellow" | "gray" | "bgWhite" | "white" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "black" | "blue" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright", ColorFunction>;
|
|
55
55
|
/**
|
|
56
56
|
* Gets a color function by name, with an option for a fallback color if the requested color is not found.
|
|
57
57
|
* @param {ColorName} color - The name of the color function to get. See {@link ColorName}.
|
|
@@ -8,10 +8,7 @@ const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
|
8
8
|
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
9
9
|
const isWindows = platform === "win32";
|
|
10
10
|
const isDumbTerminal = env.TERM === "dumb";
|
|
11
|
-
const isCompatibleTerminal = (
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
13
|
-
tty?.isatty?.(1) && env.TERM && !isDumbTerminal
|
|
14
|
-
);
|
|
11
|
+
const isCompatibleTerminal = tty?.isatty?.(1) && env.TERM && !isDumbTerminal;
|
|
15
12
|
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
16
13
|
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
17
14
|
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
@@ -21,7 +18,7 @@ function clearBleed(index, string, open, close, replace) {
|
|
|
21
18
|
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
22
19
|
}
|
|
23
20
|
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
24
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
21
|
+
return (string) => string || !(string === "" || string === void 0) ? clearBleed(string.indexOf(close, at), string, open, close, replace) : "";
|
|
25
22
|
}
|
|
26
23
|
function init(open, close, replace) {
|
|
27
24
|
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type { LogLevelDeprecated, LogTypeDeprecated, } from "./core-impl/deprecated/components/levels/levels.js";
|
|
2
|
+
export { LogLevelsDeprecated, LogTypesDeprecated, } from "./core-impl/deprecated/components/levels/levels.js";
|
|
3
|
+
export { createRelinkaBaseDeprecated, relinkaBasicDeprecated, } from "./core-impl/deprecated/components/modes/basic.js";
|
|
4
|
+
export { createRelinkaBrowserDeprecatedDeprecated, relinkaBrowserDeprecated, } from "./core-impl/deprecated/components/modes/browser.js";
|
|
5
|
+
export { relinkaDeprecated } from "./core-impl/deprecated/components/relinka-deprecated/logger.js";
|
|
6
|
+
export { createRelinkaSharedDeprecated, relinkaInstanceDeprecated, } from "./core-impl/deprecated/components/relinka-deprecated/mod.js";
|
|
7
|
+
export type { LogFn, RelinkaInstanceDeprecated, } from "./core-impl/deprecated/components/relinka-deprecated/relinka.js";
|
|
8
|
+
export { RelinkaInterface, createRelinkaDeprecated, } from "./core-impl/deprecated/components/relinka-deprecated/relinka.js";
|
|
9
|
+
export { BasicReporter } from "./core-impl/deprecated/components/reporters/basic.js";
|
|
10
|
+
export { BrowserReporter } from "./core-impl/deprecated/components/reporters/browser.js";
|
|
11
|
+
export { TYPE_COLOR_MAP, LEVEL_COLOR_MAP, FancyReporter, } from "./core-impl/deprecated/components/reporters/fancy.js";
|
|
12
|
+
export type { RelinkaOptions, FormatOptions, InputLogObject, LogObject, RelinkaReporter, } from "./core-impl/deprecated/types/mod.js";
|
|
13
|
+
export type { BoxBorderStyle, BoxStyle, BoxOpts, } from "./core-impl/deprecated/utils/box.js";
|
|
14
|
+
export { box } from "./core-impl/deprecated/utils/box.js";
|
|
15
|
+
export type { ColorName, ColorFunction, } from "./core-impl/deprecated/utils/deprecatedColors.js";
|
|
16
|
+
export { colors, getColor, colorize, } from "./core-impl/deprecated/utils/deprecatedColors.js";
|
|
17
|
+
export { parseStack } from "./core-impl/deprecated/utils/error.js";
|
|
18
|
+
export { compileFormat, formatString, } from "./core-impl/deprecated/utils/format.js";
|
|
19
|
+
export { isPlainObject, isLogObj } from "./core-impl/deprecated/utils/log.js";
|
|
20
|
+
export { writeStream } from "./core-impl/deprecated/utils/stream.js";
|
|
21
|
+
export { stripAnsi, centerAlign, rightAlign, leftAlign, align, } from "./core-impl/deprecated/utils/string.js";
|
|
22
|
+
export type { TreeItemObject, TreeItem, TreeOptions, } from "./core-impl/deprecated/utils/tree.js";
|
|
23
|
+
export { formatTree } from "./core-impl/deprecated/utils/tree.js";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export {
|
|
2
|
+
LogLevelsDeprecated,
|
|
3
|
+
LogTypesDeprecated
|
|
4
|
+
} from "./core-impl/deprecated/components/levels/levels.js";
|
|
5
|
+
export {
|
|
6
|
+
createRelinkaBaseDeprecated,
|
|
7
|
+
relinkaBasicDeprecated
|
|
8
|
+
} from "./core-impl/deprecated/components/modes/basic.js";
|
|
9
|
+
export {
|
|
10
|
+
createRelinkaBrowserDeprecatedDeprecated,
|
|
11
|
+
relinkaBrowserDeprecated
|
|
12
|
+
} from "./core-impl/deprecated/components/modes/browser.js";
|
|
13
|
+
export { relinkaDeprecated } from "./core-impl/deprecated/components/relinka-deprecated/logger.js";
|
|
14
|
+
export {
|
|
15
|
+
createRelinkaSharedDeprecated,
|
|
16
|
+
relinkaInstanceDeprecated
|
|
17
|
+
} from "./core-impl/deprecated/components/relinka-deprecated/mod.js";
|
|
18
|
+
export {
|
|
19
|
+
RelinkaInterface,
|
|
20
|
+
createRelinkaDeprecated
|
|
21
|
+
} from "./core-impl/deprecated/components/relinka-deprecated/relinka.js";
|
|
22
|
+
export { BasicReporter } from "./core-impl/deprecated/components/reporters/basic.js";
|
|
23
|
+
export { BrowserReporter } from "./core-impl/deprecated/components/reporters/browser.js";
|
|
24
|
+
export {
|
|
25
|
+
TYPE_COLOR_MAP,
|
|
26
|
+
LEVEL_COLOR_MAP,
|
|
27
|
+
FancyReporter
|
|
28
|
+
} from "./core-impl/deprecated/components/reporters/fancy.js";
|
|
29
|
+
export { box } from "./core-impl/deprecated/utils/box.js";
|
|
30
|
+
export {
|
|
31
|
+
colors,
|
|
32
|
+
getColor,
|
|
33
|
+
colorize
|
|
34
|
+
} from "./core-impl/deprecated/utils/deprecatedColors.js";
|
|
35
|
+
export { parseStack } from "./core-impl/deprecated/utils/error.js";
|
|
36
|
+
export {
|
|
37
|
+
compileFormat,
|
|
38
|
+
formatString
|
|
39
|
+
} from "./core-impl/deprecated/utils/format.js";
|
|
40
|
+
export { isPlainObject, isLogObj } from "./core-impl/deprecated/utils/log.js";
|
|
41
|
+
export { writeStream } from "./core-impl/deprecated/utils/stream.js";
|
|
42
|
+
export {
|
|
43
|
+
stripAnsi,
|
|
44
|
+
centerAlign,
|
|
45
|
+
rightAlign,
|
|
46
|
+
leftAlign,
|
|
47
|
+
align
|
|
48
|
+
} from "./core-impl/deprecated/utils/string.js";
|
|
49
|
+
export { formatTree } from "./core-impl/deprecated/utils/tree.js";
|
package/bin/main.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./libs/core/core-main.js";
|
package/bin/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./libs/core/core-main.js";
|
package/package.json
CHANGED
|
@@ -41,11 +41,12 @@
|
|
|
41
41
|
"window-size": "^1.1.1",
|
|
42
42
|
"wrap-ansi": "^9.0.0"
|
|
43
43
|
},
|
|
44
|
+
"description": "@reliverse/relinka is a powerful logger for your terminal.",
|
|
44
45
|
"homepage": "https://docs.reliverse.org",
|
|
45
46
|
"license": "MIT",
|
|
46
47
|
"name": "@reliverse/relinka",
|
|
47
48
|
"type": "module",
|
|
48
|
-
"version": "1.3.
|
|
49
|
+
"version": "1.3.4",
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@arethetypeswrong/cli": "^0.17.4",
|
|
51
52
|
"@biomejs/biome": "1.9.4",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { LogObject } from "../../../main.js";
|
|
2
|
-
/**
|
|
3
|
-
* Defines the level of logs as specific numbers or special number types.
|
|
4
|
-
*
|
|
5
|
-
* @type {0 | 1 | 2 | 3 | 4 | 5 | (number & {})} LogLevel - Represents the log level.
|
|
6
|
-
* @default 0 - Represents the default log level.
|
|
7
|
-
*/
|
|
8
|
-
export type LogLevel = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
|
|
9
|
-
/**
|
|
10
|
-
* A mapping of `LogType` to its corresponding numeric log level.
|
|
11
|
-
*
|
|
12
|
-
* @type {Record<LogType, number>} LogLevels - key-value pairs of log types to their numeric levels. See {@link LogType}.
|
|
13
|
-
*/
|
|
14
|
-
export declare const LogLevels: Record<LogType, number>;
|
|
15
|
-
/**
|
|
16
|
-
* Lists the types of log messages supported by the system.
|
|
17
|
-
*
|
|
18
|
-
* @type {"silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose"} LogType - Represents the specific type of log message.
|
|
19
|
-
*/
|
|
20
|
-
export type LogType = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
|
|
21
|
-
/**
|
|
22
|
-
* Maps `LogType` to a `Partial<LogObject>`, primarily defining the log level.
|
|
23
|
-
*
|
|
24
|
-
* @type {Record<LogType, Partial<LogObject>>} LogTypes - key-value pairs of log types to partial log objects, specifying log levels. See {@link LogType} and {@link LogObject}.
|
|
25
|
-
*/
|
|
26
|
-
export declare const LogTypes: Record<LogType, Partial<LogObject>>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { RelinkaInstance } from "../relinka/relinka.js";
|
|
2
|
-
import type { RelinkaOptions } from "../../types/mod.js";
|
|
3
|
-
export * from "./shared.js";
|
|
4
|
-
/**
|
|
5
|
-
* Factory function to create a new Relinka instance
|
|
6
|
-
*
|
|
7
|
-
* @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
|
|
8
|
-
* @returns {RelinkaInstance} A new Relinka instance configured with the given options.
|
|
9
|
-
*/
|
|
10
|
-
export declare function createRelinka(options?: Partial<RelinkaOptions & {
|
|
11
|
-
fancy: boolean;
|
|
12
|
-
}>): RelinkaInstance;
|
|
13
|
-
/**
|
|
14
|
-
* Creates and exports a standard instance of Relinka with the default configuration.
|
|
15
|
-
* This instance can be used directly for logging throughout the application.
|
|
16
|
-
*
|
|
17
|
-
* @type {RelinkaInstance} relinka - The default instance of Relinka.
|
|
18
|
-
*/
|
|
19
|
-
export declare const relinkaBasic: RelinkaInstance;
|
|
20
|
-
export default relinkaBasic;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { LogLevels } from "../levels/levels.js";
|
|
2
|
-
import { createRelinka as _createRelinka } from "../relinka/relinka.js";
|
|
3
|
-
import { BasicReporter } from "../reporters/basic.js";
|
|
4
|
-
export * from "./shared.js";
|
|
5
|
-
export function createRelinka(options = {}) {
|
|
6
|
-
let level = LogLevels.info;
|
|
7
|
-
if (process.env.RELINKA_LEVEL) {
|
|
8
|
-
level = Number.parseInt(process.env.RELINKA_LEVEL) ?? level;
|
|
9
|
-
}
|
|
10
|
-
const relinka = _createRelinka({
|
|
11
|
-
level,
|
|
12
|
-
defaults: { level },
|
|
13
|
-
stdout: process.stdout,
|
|
14
|
-
stderr: process.stderr,
|
|
15
|
-
reporters: options.reporters || [new BasicReporter()],
|
|
16
|
-
...options
|
|
17
|
-
});
|
|
18
|
-
return relinka;
|
|
19
|
-
}
|
|
20
|
-
export const relinkaBasic = createRelinka();
|
|
21
|
-
export default relinkaBasic;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRelinka as _createRelinka } from "../relinka/relinka.js";
|
|
2
|
-
import { BrowserReporter } from "../reporters/browser.js";
|
|
3
|
-
export * from "./shared.js";
|
|
4
|
-
export function createRelinka(options = {}) {
|
|
5
|
-
const relinka = _createRelinka({
|
|
6
|
-
reporters: options.reporters || [new BrowserReporter({})],
|
|
7
|
-
...options
|
|
8
|
-
});
|
|
9
|
-
return relinka;
|
|
10
|
-
}
|
|
11
|
-
export const relinkaBrowser = createRelinka();
|
|
12
|
-
export default relinkaBrowser;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { LogLevels, LogTypes } from "../levels/levels.js";
|
|
2
|
-
export { RelinkaInterface } from "../relinka/relinka.js";
|
|
3
|
-
export type * from "../../types/mod.js";
|
|
4
|
-
export type { RelinkaInstance } from "../relinka/relinka.js";
|
|
5
|
-
export type { LogLevel, LogType, } from "../levels/levels.js";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { LogLevel, LogType } from "../levels/levels.js";
|
|
2
|
-
import type { FormatOptions, LogObject } from "../../../main.js";
|
|
3
|
-
import { BasicReporter } from "./basic.js";
|
|
4
|
-
export declare const TYPE_COLOR_MAP: Partial<Record<LogType, string>>;
|
|
5
|
-
export declare const LEVEL_COLOR_MAP: Partial<Record<LogLevel, string>>;
|
|
6
|
-
export declare class FancyReporter extends BasicReporter {
|
|
7
|
-
formatStack(stack: string): string;
|
|
8
|
-
formatType(logObj: LogObject, isBadge: boolean): any;
|
|
9
|
-
formatLogObj(logObj: LogObject, opts: FormatOptions): any;
|
|
10
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|