@reliverse/relinka 1.3.4 → 1.3.6
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 +1 -1
- package/bin/main.d.ts +22 -1
- package/bin/main.js +58 -1
- package/bin/relinka-impl/deprecated/components/levels/levels.d.ts +13 -0
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/modes/basic.d.ts +3 -4
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/modes/basic.js +0 -1
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/modes/browser.d.ts +6 -6
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/modes/browser.js +3 -2
- package/bin/relinka-impl/deprecated/components/modes/shared.d.ts +2 -0
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/mod.d.ts +3 -4
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/mod.js +0 -1
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/relinka.d.ts +18 -18
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/relinka.js +6 -6
- package/bin/relinka-impl/deprecated/components/relinka-deprecated/relinka.test.d.ts +1 -0
- package/bin/relinka-impl/deprecated/components/relinka-deprecated/relinka.test.js +57 -0
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/reporters/basic.d.ts +3 -3
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/reporters/browser.d.ts +1 -1
- package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/reporters/fancy.d.ts +2 -2
- package/bin/relinka-impl/impl-mod.d.ts +20 -0
- package/bin/relinka-impl/impl-mod.js +454 -0
- package/bin/{libs/core/core-impl/deprecated/types/mod.d.ts → relinka-types.d.ts} +51 -7
- package/package.json +9 -76
- package/bin/libs/core/core-impl/deprecated/components/core/core.d.ts +0 -1
- package/bin/libs/core/core-impl/deprecated/components/core/core.js +0 -1
- package/bin/libs/core/core-impl/deprecated/components/levels/levels.d.ts +0 -26
- package/bin/libs/core/core-impl/deprecated/components/modes/shared.d.ts +0 -3
- package/bin/libs/core/core-impl/deprecated/utils/mod.d.ts +0 -3
- package/bin/libs/core/core-impl/deprecated/utils/mod.js +0 -9
- package/bin/libs/core/core-main.d.ts +0 -23
- package/bin/libs/core/core-main.js +0 -49
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/levels/levels.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/modes/shared.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/logger.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/logger.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/reporters/basic.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/reporters/browser.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/reporters/fancy.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/box.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/box.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/deprecatedColors.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/deprecatedColors.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/error.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/error.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/format.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/format.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/log.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/log.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/stream.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/stream.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/string.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/string.js +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/tree.d.ts +0 -0
- /package/bin/{libs/core/core-impl → relinka-impl}/deprecated/utils/tree.js +0 -0
- /package/bin/{libs/core/core-impl/deprecated/types/mod.js → relinka-types.js} +0 -0
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Want to test Relinka before integrating it into your project? Clone the repo and
|
|
|
30
30
|
git clone https://github.com/reliverse/relinka-logger.git
|
|
31
31
|
cd relinka-logger
|
|
32
32
|
bun i
|
|
33
|
-
bun dev # bun examples/main.ts
|
|
33
|
+
bun dev # bun examples/e-main.ts
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Relidler Usage
|
package/bin/main.d.ts
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { LogLevelsDeprecated, LogTypesDeprecated, } from "./relinka-impl/deprecated/components/levels/levels.js";
|
|
2
|
+
export { createRelinkaBaseDeprecated, relinkaBasicDeprecated, } from "./relinka-impl/deprecated/components/modes/basic.js";
|
|
3
|
+
export { createRelinkaBrowserDeprecatedDeprecated, relinkaBrowserDeprecated, } from "./relinka-impl/deprecated/components/modes/browser.js";
|
|
4
|
+
export { relinkaDeprecated } from "./relinka-impl/deprecated/components/relinka-deprecated/logger.js";
|
|
5
|
+
export { createRelinkaSharedDeprecated, relinkaInstanceDeprecated, } from "./relinka-impl/deprecated/components/relinka-deprecated/mod.js";
|
|
6
|
+
export type { LogFn, RelinkaInstanceDeprecated, } from "./relinka-impl/deprecated/components/relinka-deprecated/relinka.js";
|
|
7
|
+
export { RelinkaInterface, createRelinkaDeprecated, } from "./relinka-impl/deprecated/components/relinka-deprecated/relinka.js";
|
|
8
|
+
export { BasicReporter } from "./relinka-impl/deprecated/components/reporters/basic.js";
|
|
9
|
+
export { BrowserReporter } from "./relinka-impl/deprecated/components/reporters/browser.js";
|
|
10
|
+
export { TYPE_COLOR_MAP, LEVEL_COLOR_MAP, FancyReporter, } from "./relinka-impl/deprecated/components/reporters/fancy.js";
|
|
11
|
+
export type { BoxBorderStyle, BoxStyle, BoxOpts, } from "./relinka-impl/deprecated/utils/box.js";
|
|
12
|
+
export { box } from "./relinka-impl/deprecated/utils/box.js";
|
|
13
|
+
export type { ColorName, ColorFunction, } from "./relinka-impl/deprecated/utils/deprecatedColors.js";
|
|
14
|
+
export { colors, getColor, colorize, } from "./relinka-impl/deprecated/utils/deprecatedColors.js";
|
|
15
|
+
export { parseStack } from "./relinka-impl/deprecated/utils/error.js";
|
|
16
|
+
export { compileFormat, formatString, } from "./relinka-impl/deprecated/utils/format.js";
|
|
17
|
+
export { isPlainObject, isLogObj, } from "./relinka-impl/deprecated/utils/log.js";
|
|
18
|
+
export { writeStream } from "./relinka-impl/deprecated/utils/stream.js";
|
|
19
|
+
export { stripAnsi, centerAlign, rightAlign, leftAlign, align, } from "./relinka-impl/deprecated/utils/string.js";
|
|
20
|
+
export type { TreeItemObject, TreeItem, TreeOptions, } from "./relinka-impl/deprecated/utils/tree.js";
|
|
21
|
+
export { formatTree } from "./relinka-impl/deprecated/utils/tree.js";
|
|
22
|
+
export { configPromise, relinka, relinkaAsync, defineConfig, } from "./relinka-impl/impl-mod.js";
|
package/bin/main.js
CHANGED
|
@@ -1 +1,58 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {
|
|
2
|
+
LogLevelsDeprecated,
|
|
3
|
+
LogTypesDeprecated
|
|
4
|
+
} from "./relinka-impl/deprecated/components/levels/levels.js";
|
|
5
|
+
export {
|
|
6
|
+
createRelinkaBaseDeprecated,
|
|
7
|
+
relinkaBasicDeprecated
|
|
8
|
+
} from "./relinka-impl/deprecated/components/modes/basic.js";
|
|
9
|
+
export {
|
|
10
|
+
createRelinkaBrowserDeprecatedDeprecated,
|
|
11
|
+
relinkaBrowserDeprecated
|
|
12
|
+
} from "./relinka-impl/deprecated/components/modes/browser.js";
|
|
13
|
+
export { relinkaDeprecated } from "./relinka-impl/deprecated/components/relinka-deprecated/logger.js";
|
|
14
|
+
export {
|
|
15
|
+
createRelinkaSharedDeprecated,
|
|
16
|
+
relinkaInstanceDeprecated
|
|
17
|
+
} from "./relinka-impl/deprecated/components/relinka-deprecated/mod.js";
|
|
18
|
+
export {
|
|
19
|
+
RelinkaInterface,
|
|
20
|
+
createRelinkaDeprecated
|
|
21
|
+
} from "./relinka-impl/deprecated/components/relinka-deprecated/relinka.js";
|
|
22
|
+
export { BasicReporter } from "./relinka-impl/deprecated/components/reporters/basic.js";
|
|
23
|
+
export { BrowserReporter } from "./relinka-impl/deprecated/components/reporters/browser.js";
|
|
24
|
+
export {
|
|
25
|
+
TYPE_COLOR_MAP,
|
|
26
|
+
LEVEL_COLOR_MAP,
|
|
27
|
+
FancyReporter
|
|
28
|
+
} from "./relinka-impl/deprecated/components/reporters/fancy.js";
|
|
29
|
+
export { box } from "./relinka-impl/deprecated/utils/box.js";
|
|
30
|
+
export {
|
|
31
|
+
colors,
|
|
32
|
+
getColor,
|
|
33
|
+
colorize
|
|
34
|
+
} from "./relinka-impl/deprecated/utils/deprecatedColors.js";
|
|
35
|
+
export { parseStack } from "./relinka-impl/deprecated/utils/error.js";
|
|
36
|
+
export {
|
|
37
|
+
compileFormat,
|
|
38
|
+
formatString
|
|
39
|
+
} from "./relinka-impl/deprecated/utils/format.js";
|
|
40
|
+
export {
|
|
41
|
+
isPlainObject,
|
|
42
|
+
isLogObj
|
|
43
|
+
} from "./relinka-impl/deprecated/utils/log.js";
|
|
44
|
+
export { writeStream } from "./relinka-impl/deprecated/utils/stream.js";
|
|
45
|
+
export {
|
|
46
|
+
stripAnsi,
|
|
47
|
+
centerAlign,
|
|
48
|
+
rightAlign,
|
|
49
|
+
leftAlign,
|
|
50
|
+
align
|
|
51
|
+
} from "./relinka-impl/deprecated/utils/string.js";
|
|
52
|
+
export { formatTree } from "./relinka-impl/deprecated/utils/tree.js";
|
|
53
|
+
export {
|
|
54
|
+
configPromise,
|
|
55
|
+
relinka,
|
|
56
|
+
relinkaAsync,
|
|
57
|
+
defineConfig
|
|
58
|
+
} from "./relinka-impl/impl-mod.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LogObject, LogTypeDeprecated } from "../../../../relinka-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A mapping of `LogTypeDeprecated` to its corresponding numeric log level.
|
|
4
|
+
*
|
|
5
|
+
* @type {Record<LogTypeDeprecated, number>} LogLevelsDeprecated - key-value pairs of log types to their numeric levels. See {@link LogTypeDeprecated}.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LogLevelsDeprecated: Record<LogTypeDeprecated, number>;
|
|
8
|
+
/**
|
|
9
|
+
* Maps `LogTypeDeprecated` to a `Partial<LogObject>`, primarily defining the log level.
|
|
10
|
+
*
|
|
11
|
+
* @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}.
|
|
12
|
+
*/
|
|
13
|
+
export declare const LogTypesDeprecated: Record<LogTypeDeprecated, Partial<LogObject>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { RelinkaInstanceDeprecated } from "../relinka-deprecated/relinka.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RelinkaOptionsDeprecated } from "../../../../relinka-types.js";
|
|
3
3
|
export * from "./shared.js";
|
|
4
4
|
/**
|
|
5
5
|
* Factory function to create a new Relinka instance
|
|
6
6
|
*
|
|
7
|
-
* @param {Partial<
|
|
7
|
+
* @param {Partial<RelinkaOptionsDeprecated & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptionsDeprecated}.
|
|
8
8
|
* @returns {RelinkaInstanceDeprecated} A new Relinka instance configured with the given options.
|
|
9
9
|
*/
|
|
10
|
-
export declare function createRelinkaBaseDeprecated(options?: Partial<
|
|
10
|
+
export declare function createRelinkaBaseDeprecated(options?: Partial<RelinkaOptionsDeprecated & {
|
|
11
11
|
fancy: boolean;
|
|
12
12
|
}>): RelinkaInstanceDeprecated;
|
|
13
13
|
/**
|
|
@@ -17,4 +17,3 @@ export declare function createRelinkaBaseDeprecated(options?: Partial<RelinkaOpt
|
|
|
17
17
|
* @type {RelinkaInstanceDeprecated} relinka - The default instance of Relinka.
|
|
18
18
|
*/
|
|
19
19
|
export declare const relinkaBasicDeprecated: RelinkaInstanceDeprecated;
|
|
20
|
-
export default relinkaBasicDeprecated;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RelinkaOptionsDeprecated } from "../../../../relinka-types.js";
|
|
2
|
+
import { type RelinkaInstanceDeprecated } from "../relinka-deprecated/relinka.js";
|
|
2
3
|
export * from "./shared.js";
|
|
3
4
|
/**
|
|
4
5
|
* Creates a new Relinka instance configured specifically for browser environments.
|
|
5
6
|
* This function sets up default reporters and a prompt method tailored to the browser's dialogue APIs.
|
|
6
7
|
*
|
|
7
|
-
* @param {Partial<
|
|
8
|
-
* The options can override the default reporter and prompt behavior. See {@link
|
|
8
|
+
* @param {Partial<RelinkaOptionsDeprecated>} [options={}] - Optional configuration options.
|
|
9
|
+
* The options can override the default reporter and prompt behavior. See {@link RelinkaOptionsDeprecated}.
|
|
9
10
|
* @returns {RelinkaInstanceDeprecated} A new Relinka instance optimized for use in browser environments.
|
|
10
11
|
*/
|
|
11
|
-
export declare function createRelinkaBrowserDeprecatedDeprecated(options?: Partial<
|
|
12
|
+
export declare function createRelinkaBrowserDeprecatedDeprecated(options?: Partial<RelinkaOptionsDeprecated>): any;
|
|
12
13
|
/**
|
|
13
14
|
* A standard Relinka instance created with browser-specific configurations.
|
|
14
15
|
* This instance can be used throughout a browser-based project.
|
|
15
16
|
*
|
|
16
17
|
* @type {RelinkaInstanceDeprecated} relinka - The default browser-configured Relinka instance.
|
|
17
18
|
*/
|
|
18
|
-
export declare const relinkaBrowserDeprecated:
|
|
19
|
-
export default relinkaBrowserDeprecated;
|
|
19
|
+
export declare const relinkaBrowserDeprecated: RelinkaInstanceDeprecated;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createRelinkaDeprecated as _createRelinkaDeprecated
|
|
3
|
+
} from "../relinka-deprecated/relinka.js";
|
|
2
4
|
import { BrowserReporter } from "../reporters/browser.js";
|
|
3
5
|
export * from "./shared.js";
|
|
4
6
|
export function createRelinkaBrowserDeprecatedDeprecated(options = {}) {
|
|
@@ -9,4 +11,3 @@ export function createRelinkaBrowserDeprecatedDeprecated(options = {}) {
|
|
|
9
11
|
return relinka;
|
|
10
12
|
}
|
|
11
13
|
export const relinkaBrowserDeprecated = createRelinkaBrowserDeprecatedDeprecated();
|
|
12
|
-
export default relinkaBrowserDeprecated;
|
package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/mod.d.ts
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RelinkaOptionsDeprecated } from "../../../../relinka-types.js";
|
|
2
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
|
-
* @param {Partial<
|
|
8
|
+
* @param {Partial<RelinkaOptionsDeprecated & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptionsDeprecated}.
|
|
9
9
|
* @returns {RelinkaInstanceDeprecated} A new Relinka instance with configurations based on the given options and the execution environment.
|
|
10
10
|
*/
|
|
11
|
-
export declare function createRelinkaSharedDeprecated(options?: Partial<
|
|
11
|
+
export declare function createRelinkaSharedDeprecated(options?: Partial<RelinkaOptionsDeprecated & {
|
|
12
12
|
fancy: boolean;
|
|
13
13
|
}>): RelinkaInstanceDeprecated;
|
|
14
14
|
/**
|
|
@@ -18,4 +18,3 @@ export declare function createRelinkaSharedDeprecated(options?: Partial<RelinkaO
|
|
|
18
18
|
* @type {RelinkaInstanceDeprecated} relinka - The default Relinka instance, ready to use.
|
|
19
19
|
*/
|
|
20
20
|
export declare const relinkaInstanceDeprecated: RelinkaInstanceDeprecated;
|
|
21
|
-
export default relinkaInstanceDeprecated;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { LogTypeDeprecated } from "
|
|
3
|
-
import type { InputLogObject, LogObject,
|
|
2
|
+
import type { LogTypeDeprecated } from "../../../../relinka-types.js";
|
|
3
|
+
import type { InputLogObject, LogObject, RelinkaOptionsDeprecated, RelinkaReporterDeprecated } from "../../../../relinka-types.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.
|
|
@@ -8,7 +8,7 @@ import type { InputLogObject, LogObject, RelinkaOptions, RelinkaReporter } from
|
|
|
8
8
|
* @class Relinka
|
|
9
9
|
*/
|
|
10
10
|
export declare class RelinkaInterface {
|
|
11
|
-
options:
|
|
11
|
+
options: RelinkaOptionsDeprecated;
|
|
12
12
|
_lastLog: {
|
|
13
13
|
serialized?: string;
|
|
14
14
|
object?: LogObject;
|
|
@@ -18,13 +18,13 @@ export declare class RelinkaInterface {
|
|
|
18
18
|
};
|
|
19
19
|
_paused: boolean;
|
|
20
20
|
_queue: any[];
|
|
21
|
-
_mockFn?:
|
|
21
|
+
_mockFn?: RelinkaOptionsDeprecated["mockFn"];
|
|
22
22
|
/**
|
|
23
23
|
* Creates an instance of Relinka with specified options or defaults.
|
|
24
24
|
*
|
|
25
|
-
* @param {Partial<
|
|
25
|
+
* @param {Partial<RelinkaOptionsDeprecated>} [options={}] - Configuration options for the Relinka instance.
|
|
26
26
|
*/
|
|
27
|
-
constructor(options?: Partial<
|
|
27
|
+
constructor(options?: Partial<RelinkaOptionsDeprecated>);
|
|
28
28
|
/**
|
|
29
29
|
* Gets the current log level of the Relinka instance.
|
|
30
30
|
*
|
|
@@ -40,10 +40,10 @@ export declare class RelinkaInterface {
|
|
|
40
40
|
/**
|
|
41
41
|
* Creates a new instance of Relinka, inheriting options from the current instance, with possible overrides.
|
|
42
42
|
*
|
|
43
|
-
* @param {Partial<
|
|
43
|
+
* @param {Partial<RelinkaOptionsDeprecated>} options - Optional overrides for the new instance. See {@link RelinkaOptionsDeprecated}.
|
|
44
44
|
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
45
45
|
*/
|
|
46
|
-
create(options: Partial<
|
|
46
|
+
create(options: Partial<RelinkaOptionsDeprecated>): RelinkaInstanceDeprecated;
|
|
47
47
|
/**
|
|
48
48
|
* Creates a new Relinka instance with the specified default log object properties.
|
|
49
49
|
*
|
|
@@ -62,25 +62,25 @@ export declare class RelinkaInterface {
|
|
|
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.
|
|
64
64
|
*
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {RelinkaReporterDeprecated} reporter - The reporter to add. See {@link RelinkaReporterDeprecated}.
|
|
66
66
|
* @returns {Relinka} The current Relinka instance.
|
|
67
67
|
*/
|
|
68
|
-
addReporter(reporter:
|
|
68
|
+
addReporter(reporter: RelinkaReporterDeprecated): this;
|
|
69
69
|
/**
|
|
70
70
|
* Removes a custom reporter from the Relinka instance.
|
|
71
71
|
* If no reporter is specified, all reporters will be removed.
|
|
72
72
|
*
|
|
73
|
-
* @param {
|
|
73
|
+
* @param {RelinkaReporterDeprecated} reporter - The reporter to remove. See {@link RelinkaReporterDeprecated}.
|
|
74
74
|
* @returns {Relinka} The current Relinka instance.
|
|
75
75
|
*/
|
|
76
|
-
removeReporter(reporter:
|
|
76
|
+
removeReporter(reporter: RelinkaReporterDeprecated): any;
|
|
77
77
|
/**
|
|
78
78
|
* Replaces all reporters of the Relinka instance with the specified array of reporters.
|
|
79
79
|
*
|
|
80
|
-
* @param {
|
|
80
|
+
* @param {RelinkaReporterDeprecated[]} reporters - The new reporters to set. See {@link RelinkaReporterDeprecated}.
|
|
81
81
|
* @returns {Relinka} The current Relinka instance.
|
|
82
82
|
*/
|
|
83
|
-
setReporters(reporters:
|
|
83
|
+
setReporters(reporters: RelinkaReporterDeprecated[]): this;
|
|
84
84
|
wrapAll(): void;
|
|
85
85
|
restoreAll(): void;
|
|
86
86
|
/**
|
|
@@ -120,9 +120,9 @@ export declare class RelinkaInterface {
|
|
|
120
120
|
/**
|
|
121
121
|
* Replaces logging methods with mocks if a mock function is provided.
|
|
122
122
|
*
|
|
123
|
-
* @param {
|
|
123
|
+
* @param {RelinkaOptionsDeprecated["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link RelinkaOptionsDeprecated["mockFn"]}.
|
|
124
124
|
*/
|
|
125
|
-
mockTypes(mockFn?:
|
|
125
|
+
mockTypes(mockFn?: RelinkaOptionsDeprecated["mockFn"]): void;
|
|
126
126
|
_wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => boolean;
|
|
127
127
|
_logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): boolean;
|
|
128
128
|
_log(logObj: LogObject): void;
|
|
@@ -135,7 +135,7 @@ export type RelinkaInstanceDeprecated = RelinkaInterface & Record<LogTypeDepreca
|
|
|
135
135
|
/**
|
|
136
136
|
* Utility for creating a new Relinka instance with optional configuration.
|
|
137
137
|
*
|
|
138
|
-
* @param {Partial<
|
|
138
|
+
* @param {Partial<RelinkaOptionsDeprecated>} [options={}] - Optional configuration options for the new Relinka instance. See {@link RelinkaOptionsDeprecated}.
|
|
139
139
|
* @returns {RelinkaInstanceDeprecated} A new instance of RelinkaInterface. See {@link RelinkaInstanceDeprecated}.
|
|
140
140
|
*/
|
|
141
|
-
export declare function createRelinkaDeprecated(options?: Partial<
|
|
141
|
+
export declare function createRelinkaDeprecated(options?: Partial<RelinkaOptionsDeprecated>): RelinkaInstanceDeprecated;
|
package/bin/{libs/core/core-impl → relinka-impl}/deprecated/components/relinka-deprecated/relinka.js
RENAMED
|
@@ -11,7 +11,7 @@ export class RelinkaInterface {
|
|
|
11
11
|
/**
|
|
12
12
|
* Creates an instance of Relinka with specified options or defaults.
|
|
13
13
|
*
|
|
14
|
-
* @param {Partial<
|
|
14
|
+
* @param {Partial<RelinkaOptionsDeprecated>} [options={}] - Configuration options for the Relinka instance.
|
|
15
15
|
*/
|
|
16
16
|
constructor(options = {}) {
|
|
17
17
|
const types = options.types || LogTypesDeprecated;
|
|
@@ -72,7 +72,7 @@ export class RelinkaInterface {
|
|
|
72
72
|
/**
|
|
73
73
|
* Creates a new instance of Relinka, inheriting options from the current instance, with possible overrides.
|
|
74
74
|
*
|
|
75
|
-
* @param {Partial<
|
|
75
|
+
* @param {Partial<RelinkaOptionsDeprecated>} options - Optional overrides for the new instance. See {@link RelinkaOptionsDeprecated}.
|
|
76
76
|
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
77
77
|
*/
|
|
78
78
|
create(options) {
|
|
@@ -115,7 +115,7 @@ export class RelinkaInterface {
|
|
|
115
115
|
* Adds a custom reporter to the Relinka instance.
|
|
116
116
|
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
117
117
|
*
|
|
118
|
-
* @param {
|
|
118
|
+
* @param {RelinkaReporterDeprecated} reporter - The reporter to add. See {@link RelinkaReporterDeprecated}.
|
|
119
119
|
* @returns {Relinka} The current Relinka instance.
|
|
120
120
|
*/
|
|
121
121
|
addReporter(reporter) {
|
|
@@ -126,7 +126,7 @@ export class RelinkaInterface {
|
|
|
126
126
|
* Removes a custom reporter from the Relinka instance.
|
|
127
127
|
* If no reporter is specified, all reporters will be removed.
|
|
128
128
|
*
|
|
129
|
-
* @param {
|
|
129
|
+
* @param {RelinkaReporterDeprecated} reporter - The reporter to remove. See {@link RelinkaReporterDeprecated}.
|
|
130
130
|
* @returns {Relinka} The current Relinka instance.
|
|
131
131
|
*/
|
|
132
132
|
removeReporter(reporter) {
|
|
@@ -143,7 +143,7 @@ export class RelinkaInterface {
|
|
|
143
143
|
/**
|
|
144
144
|
* Replaces all reporters of the Relinka instance with the specified array of reporters.
|
|
145
145
|
*
|
|
146
|
-
* @param {
|
|
146
|
+
* @param {RelinkaReporterDeprecated[]} reporters - The new reporters to set. See {@link RelinkaReporterDeprecated}.
|
|
147
147
|
* @returns {Relinka} The current Relinka instance.
|
|
148
148
|
*/
|
|
149
149
|
setReporters(reporters) {
|
|
@@ -250,7 +250,7 @@ export class RelinkaInterface {
|
|
|
250
250
|
/**
|
|
251
251
|
* Replaces logging methods with mocks if a mock function is provided.
|
|
252
252
|
*
|
|
253
|
-
* @param {
|
|
253
|
+
* @param {RelinkaOptionsDeprecated["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link RelinkaOptionsDeprecated["mockFn"]}.
|
|
254
254
|
*/
|
|
255
255
|
mockTypes(mockFn) {
|
|
256
256
|
const _mockFn = mockFn || this.options.mockFn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { createRelinkaDeprecated } from "./relinka.js";
|
|
3
|
+
import {
|
|
4
|
+
LogLevelsDeprecated
|
|
5
|
+
} from "./mod.js";
|
|
6
|
+
describe("relinka", () => {
|
|
7
|
+
test("can set level", () => {
|
|
8
|
+
const relinka = createRelinkaDeprecated();
|
|
9
|
+
expect(relinka.level).toBe(1);
|
|
10
|
+
for (let i = 0; i <= 5; i++) {
|
|
11
|
+
relinka.level = i;
|
|
12
|
+
expect(relinka.level).toBe(i);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
test("silent log level does't print logs", async () => {
|
|
16
|
+
const logs = [];
|
|
17
|
+
const TestReporter = {
|
|
18
|
+
log(logObj) {
|
|
19
|
+
logs.push(logObj);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const relinka = createRelinkaDeprecated({
|
|
23
|
+
throttle: 100,
|
|
24
|
+
level: LogLevelsDeprecated.silent,
|
|
25
|
+
reporters: [TestReporter]
|
|
26
|
+
});
|
|
27
|
+
for (let i = 0; i < 10; i++) {
|
|
28
|
+
relinka.log("SPAM");
|
|
29
|
+
}
|
|
30
|
+
await wait(200);
|
|
31
|
+
expect(logs.length).toBe(0);
|
|
32
|
+
});
|
|
33
|
+
test("can see spams without ending log", async () => {
|
|
34
|
+
const logs = [];
|
|
35
|
+
const TestReporter = {
|
|
36
|
+
log(logObj) {
|
|
37
|
+
logs.push(logObj);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const relinka = createRelinkaDeprecated({
|
|
41
|
+
throttle: 100,
|
|
42
|
+
level: LogLevelsDeprecated.info,
|
|
43
|
+
reporters: [TestReporter]
|
|
44
|
+
});
|
|
45
|
+
for (let i = 0; i < 10; i++) {
|
|
46
|
+
relinka.log("SPAM");
|
|
47
|
+
}
|
|
48
|
+
await wait(300);
|
|
49
|
+
expect(logs.length).toBe(7);
|
|
50
|
+
expect(logs.at(-1).args).toEqual(["SPAM", "(repeated 4 times)"]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
function wait(delay) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
setTimeout(resolve, delay);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { LogObject,
|
|
2
|
-
export declare class BasicReporter implements
|
|
1
|
+
import type { LogObject, RelinkaReporterDeprecated, FormatOptions, RelinkaOptionsDeprecated } from "../../../../relinka-types.js";
|
|
2
|
+
export declare class BasicReporter implements RelinkaReporterDeprecated {
|
|
3
3
|
formatStack(stack: string): string;
|
|
4
4
|
formatArgs(args: any[], opts: FormatOptions): string;
|
|
5
5
|
formatDate(date: Date, opts: FormatOptions): string;
|
|
6
6
|
filterAndJoin(arr: any[]): string;
|
|
7
7
|
formatLogObj(logObj: LogObject, opts: FormatOptions): string;
|
|
8
8
|
log(logObj: LogObject, ctx: {
|
|
9
|
-
options:
|
|
9
|
+
options: RelinkaOptionsDeprecated;
|
|
10
10
|
}): any;
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LogLevelDeprecated, LogTypeDeprecated } from "
|
|
2
|
-
import type { FormatOptions, LogObject } from "
|
|
1
|
+
import type { LogLevelDeprecated, LogTypeDeprecated } from "../../../../relinka-types.js";
|
|
2
|
+
import type { FormatOptions, LogObject } from "../../../../relinka-types.js";
|
|
3
3
|
import { BasicReporter } from "./basic.js";
|
|
4
4
|
export declare const TYPE_COLOR_MAP: Partial<Record<LogTypeDeprecated, string>>;
|
|
5
5
|
export declare const LEVEL_COLOR_MAP: Partial<Record<LogLevelDeprecated, string>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Promise that resolves when the Relinka config has been loaded and merged
|
|
3
|
+
* from defaults, environment variables, and optionally config files.
|
|
4
|
+
*/
|
|
5
|
+
export declare const configPromise: Promise<RelinkaConfig>;
|
|
6
|
+
/**
|
|
7
|
+
* Logs a message synchronously using the current config.
|
|
8
|
+
* Skips debug-level logs unless `debug` is set to true in the config.
|
|
9
|
+
*/
|
|
10
|
+
export declare const relinka: (type: LogLevel, message: string, ...args: unknown[]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Logs a message asynchronously, waiting for the config to be fully loaded.
|
|
13
|
+
* Also handles file writing and log cleanup if enabled in the config.
|
|
14
|
+
*/
|
|
15
|
+
export declare const relinkaAsync: (type: LogLevel, message: string, ...args: unknown[]) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Type helper for defining configuration in `relinka.config.ts` (or similar).
|
|
18
|
+
* Provides autocompletion and type checking for the configuration object.
|
|
19
|
+
*/
|
|
20
|
+
export declare const defineConfig: (config: RelinkaConfig) => RelinkaConfig;
|