@reliverse/relinka 1.5.3 → 1.5.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/bin/impl.d.ts +1 -137
- package/bin/impl.js +47 -102
- package/bin/mod.d.ts +1 -1
- package/bin/setup.d.ts +144 -0
- package/bin/setup.js +90 -0
- package/package.json +1 -1
package/bin/impl.d.ts
CHANGED
|
@@ -1,121 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/** Configuration for directory-related settings. */
|
|
3
|
-
export type RelinkaDirsConfig = {
|
|
4
|
-
maxLogFiles?: number;
|
|
5
|
-
};
|
|
6
|
-
/** Configuration for a single log level. */
|
|
7
|
-
export type LogLevelConfig = {
|
|
8
|
-
/**
|
|
9
|
-
* Symbol to display for this log level.
|
|
10
|
-
* @see https://symbl.cc
|
|
11
|
-
*/
|
|
12
|
-
symbol: string;
|
|
13
|
-
/**
|
|
14
|
-
* Fallback symbol to use if Unicode is not supported.
|
|
15
|
-
*/
|
|
16
|
-
fallbackSymbol: string;
|
|
17
|
-
/**
|
|
18
|
-
* Color to use for this log level.
|
|
19
|
-
*/
|
|
20
|
-
color: DefaultColorKeys;
|
|
21
|
-
/**
|
|
22
|
-
* Number of spaces after the symbol/fallback
|
|
23
|
-
*/
|
|
24
|
-
spacing?: number;
|
|
25
|
-
};
|
|
26
|
-
/** Configuration for all log levels. */
|
|
27
|
-
export type LogLevelsConfig = Partial<Record<LogLevel, LogLevelConfig>>;
|
|
28
|
-
/** Log level types used by the logger. */
|
|
29
|
-
export type LogLevel = "error" | "fatal" | "info" | "success" | "verbose" | "warn" | "log" | "internal" | "null" | "step" | "box" | "message";
|
|
30
|
-
/**
|
|
31
|
-
* Configuration options for the Relinka logger.
|
|
32
|
-
* All properties are optional to allow for partial configuration.
|
|
33
|
-
* Defaults will be applied during initialization.
|
|
34
|
-
*/
|
|
35
|
-
export type RelinkaConfig = {
|
|
36
|
-
/**
|
|
37
|
-
* Enables verbose (aka debug) mode for detailed logging.
|
|
38
|
-
*
|
|
39
|
-
* `true` here works only for end-users of CLIs/libs when theirs developers
|
|
40
|
-
* has been awaited for user's config via `@reliverse/relinka`'s `await relinkaConfig;`
|
|
41
|
-
*/
|
|
42
|
-
verbose?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Configuration for directory-related settings.
|
|
45
|
-
* - `maxLogFiles`: The maximum number of log files to keep before cleanup.
|
|
46
|
-
*/
|
|
47
|
-
dirs?: RelinkaDirsConfig;
|
|
48
|
-
/**
|
|
49
|
-
* Disables color output in the console.
|
|
50
|
-
*/
|
|
51
|
-
disableColors?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Configuration for log file output.
|
|
54
|
-
*/
|
|
55
|
-
logFile?: {
|
|
56
|
-
/**
|
|
57
|
-
* Path to the log file.
|
|
58
|
-
*/
|
|
59
|
-
outputPath?: string;
|
|
60
|
-
/**
|
|
61
|
-
* How to handle date in the filename.
|
|
62
|
-
* - `disable`: No date prefix/suffix
|
|
63
|
-
* - `append-before`: Add date before the filename (e.g., "2024-01-15-log.txt")
|
|
64
|
-
* - `append-after`: Add date after the filename (e.g., "log-2024-01-15.txt")
|
|
65
|
-
*/
|
|
66
|
-
nameWithDate?: "disable" | "append-before" | "append-after";
|
|
67
|
-
/**
|
|
68
|
-
* If true, clears the log file when relinkaConfig is executed with supportFreshLogFile: true.
|
|
69
|
-
* This is useful for starting with a clean log file on each run.
|
|
70
|
-
*/
|
|
71
|
-
freshLogFile?: boolean;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* If true, logs will be saved to a file.
|
|
75
|
-
*/
|
|
76
|
-
saveLogsToFile?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Configuration for timestamp in log messages.
|
|
79
|
-
*/
|
|
80
|
-
timestamp?: {
|
|
81
|
-
/**
|
|
82
|
-
* If true, timestamps will be added to log messages.
|
|
83
|
-
*/
|
|
84
|
-
enabled: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* The format for timestamps. Default is YYYY-MM-DD HH:mm:ss.SSS
|
|
87
|
-
*/
|
|
88
|
-
format?: string;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Allows to customize the log levels.
|
|
92
|
-
*/
|
|
93
|
-
levels?: LogLevelsConfig;
|
|
94
|
-
/**
|
|
95
|
-
* Controls how often the log cleanup runs (in milliseconds)
|
|
96
|
-
* Default: 10000 (10 seconds)
|
|
97
|
-
*/
|
|
98
|
-
cleanupInterval?: number;
|
|
99
|
-
/**
|
|
100
|
-
* Maximum size of the log write buffer before flushing to disk (in bytes)
|
|
101
|
-
* Default: 4096 (4KB)
|
|
102
|
-
*/
|
|
103
|
-
bufferSize?: number;
|
|
104
|
-
/**
|
|
105
|
-
* Maximum time to hold logs in buffer before flushing to disk (in milliseconds)
|
|
106
|
-
* Default: 5000 (5 seconds)
|
|
107
|
-
*/
|
|
108
|
-
maxBufferAge?: number;
|
|
109
|
-
};
|
|
110
|
-
/** Represents information about a log file for cleanup purposes. */
|
|
111
|
-
export type LogFileInfo = {
|
|
112
|
-
path: string;
|
|
113
|
-
mtime: number;
|
|
114
|
-
};
|
|
115
|
-
/** Options for relinkaConfig */
|
|
116
|
-
export type RelinkaConfigOptions = {
|
|
117
|
-
supportFreshLogFile?: boolean;
|
|
118
|
-
};
|
|
1
|
+
import { type LogLevel, type RelinkaConfig, type RelinkaConfigOptions, type RelinkaFunction } from "./setup";
|
|
119
2
|
/** Promise resolved once the user's config (if any) is merged. */
|
|
120
3
|
export declare const loadRelinkaConfig: Promise<RelinkaConfig>;
|
|
121
4
|
/**
|
|
@@ -143,25 +26,6 @@ export declare function truncateString(msg: string, maxLength?: number): string;
|
|
|
143
26
|
* Exhaustiveness check. If we land here, we missed a union case.
|
|
144
27
|
*/
|
|
145
28
|
export declare function casesHandled(unexpectedCase: never): never;
|
|
146
|
-
/**
|
|
147
|
-
* Enhanced relinka function type that supports both traditional and method syntax
|
|
148
|
-
*/
|
|
149
|
-
export type RelinkaFunction = {
|
|
150
|
-
(type: LogLevel | "clear", message: string, ...args: unknown[]): undefined | never;
|
|
151
|
-
error(message: string, ...args: unknown[]): void;
|
|
152
|
-
fatal(message: string, ...args: unknown[]): never;
|
|
153
|
-
info(message: string, ...args: unknown[]): void;
|
|
154
|
-
success(message: string, ...args: unknown[]): void;
|
|
155
|
-
verbose(message: string, ...args: unknown[]): void;
|
|
156
|
-
warn(message: string, ...args: unknown[]): void;
|
|
157
|
-
log(message: string, ...args: unknown[]): void;
|
|
158
|
-
internal(message: string, ...args: unknown[]): void;
|
|
159
|
-
null(message: string, ...args: unknown[]): void;
|
|
160
|
-
step(message: string, ...args: unknown[]): void;
|
|
161
|
-
box(message: string, ...args: unknown[]): void;
|
|
162
|
-
message(message: string, ...args: unknown[]): void;
|
|
163
|
-
clear(): void;
|
|
164
|
-
};
|
|
165
29
|
/**
|
|
166
30
|
* Logs a message synchronously using the current config.
|
|
167
31
|
* If type === "fatal", logs a fatal error and throws (never returns).
|
package/bin/impl.js
CHANGED
|
@@ -3,96 +3,11 @@ import { re } from "@reliverse/relico";
|
|
|
3
3
|
import fs from "@reliverse/relifso";
|
|
4
4
|
import { loadConfig } from "c12";
|
|
5
5
|
import os from "node:os";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
maxLogFiles: 0
|
|
12
|
-
},
|
|
13
|
-
disableColors: false,
|
|
14
|
-
logFile: {
|
|
15
|
-
outputPath: "logs.log",
|
|
16
|
-
nameWithDate: "disable",
|
|
17
|
-
freshLogFile: true
|
|
18
|
-
},
|
|
19
|
-
saveLogsToFile: false,
|
|
20
|
-
timestamp: {
|
|
21
|
-
enabled: false,
|
|
22
|
-
format: "YYYY-MM-DD HH:mm:ss.SSS"
|
|
23
|
-
},
|
|
24
|
-
cleanupInterval: 1e4,
|
|
25
|
-
// 10 seconds
|
|
26
|
-
bufferSize: 4096,
|
|
27
|
-
// 4KB
|
|
28
|
-
maxBufferAge: 5e3,
|
|
29
|
-
// 5 seconds
|
|
30
|
-
// A default set of levels, with fallback symbols for non-Unicode terminals:
|
|
31
|
-
levels: {
|
|
32
|
-
success: {
|
|
33
|
-
symbol: "\u2713",
|
|
34
|
-
fallbackSymbol: "[OK]",
|
|
35
|
-
color: "greenBright",
|
|
36
|
-
spacing: 3
|
|
37
|
-
},
|
|
38
|
-
info: {
|
|
39
|
-
symbol: "\u25C8",
|
|
40
|
-
fallbackSymbol: "[i]",
|
|
41
|
-
color: "cyanBright",
|
|
42
|
-
spacing: 3
|
|
43
|
-
},
|
|
44
|
-
error: {
|
|
45
|
-
symbol: "\u2716",
|
|
46
|
-
fallbackSymbol: "[ERR]",
|
|
47
|
-
color: "redBright",
|
|
48
|
-
spacing: 3
|
|
49
|
-
},
|
|
50
|
-
warn: {
|
|
51
|
-
symbol: "\u26A0",
|
|
52
|
-
fallbackSymbol: "[WARN]",
|
|
53
|
-
color: "yellowBright",
|
|
54
|
-
spacing: 3
|
|
55
|
-
},
|
|
56
|
-
fatal: {
|
|
57
|
-
symbol: "\u203C",
|
|
58
|
-
fallbackSymbol: "[FATAL]",
|
|
59
|
-
color: "redBright",
|
|
60
|
-
spacing: 3
|
|
61
|
-
},
|
|
62
|
-
verbose: {
|
|
63
|
-
symbol: "\u2731",
|
|
64
|
-
fallbackSymbol: "[VERBOSE]",
|
|
65
|
-
color: "gray",
|
|
66
|
-
spacing: 3
|
|
67
|
-
},
|
|
68
|
-
internal: {
|
|
69
|
-
symbol: "\u2699",
|
|
70
|
-
fallbackSymbol: "[INTERNAL]",
|
|
71
|
-
color: "magentaBright",
|
|
72
|
-
spacing: 3
|
|
73
|
-
},
|
|
74
|
-
log: { symbol: "\u2502", fallbackSymbol: "|", color: "dim", spacing: 3 },
|
|
75
|
-
step: {
|
|
76
|
-
symbol: "\u2192",
|
|
77
|
-
fallbackSymbol: "[STEP]",
|
|
78
|
-
color: "blueBright",
|
|
79
|
-
spacing: 3
|
|
80
|
-
},
|
|
81
|
-
box: {
|
|
82
|
-
symbol: "\u25A0",
|
|
83
|
-
fallbackSymbol: "[BOX]",
|
|
84
|
-
color: "whiteBright",
|
|
85
|
-
spacing: 1
|
|
86
|
-
},
|
|
87
|
-
message: {
|
|
88
|
-
symbol: "\u{1F7A0}",
|
|
89
|
-
fallbackSymbol: "[MSG]",
|
|
90
|
-
color: "cyan",
|
|
91
|
-
spacing: 3
|
|
92
|
-
},
|
|
93
|
-
null: { symbol: "", fallbackSymbol: "", color: "dim", spacing: 0 }
|
|
94
|
-
}
|
|
95
|
-
};
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_RELINKA_CONFIG,
|
|
8
|
+
ENABLE_DEV_DEBUG,
|
|
9
|
+
EXIT_GUARD
|
|
10
|
+
} from "./setup.js";
|
|
96
11
|
function isUnicodeSupported() {
|
|
97
12
|
if (process.env.TERM_PROGRAM === "vscode" || process.env.WT_SESSION || process.env.TERM_PROGRAM === "iTerm.app" || process.env.TERM_PROGRAM === "hyper" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM === "xterm-256color") {
|
|
98
13
|
return true;
|
|
@@ -147,22 +62,52 @@ let lastCleanupTime = 0;
|
|
|
147
62
|
let cleanupScheduled = false;
|
|
148
63
|
async function initializeConfig() {
|
|
149
64
|
try {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
65
|
+
let result;
|
|
66
|
+
try {
|
|
67
|
+
result = await loadConfig({
|
|
68
|
+
name: "dler",
|
|
69
|
+
// name: "relinka",
|
|
70
|
+
cwd: process.cwd(),
|
|
71
|
+
dotenv: false,
|
|
72
|
+
packageJson: false,
|
|
73
|
+
rcFile: false,
|
|
74
|
+
globalRc: false,
|
|
75
|
+
defaults: {}
|
|
76
|
+
});
|
|
77
|
+
if (result.config?.relinka) {
|
|
78
|
+
currentConfig = { ...DEFAULT_RELINKA_CONFIG, ...result.config.relinka };
|
|
79
|
+
if (ENABLE_DEV_DEBUG) {
|
|
80
|
+
console.log("[Dev Debug] Using relinka config from dler config");
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
currentConfig = { ...DEFAULT_RELINKA_CONFIG };
|
|
84
|
+
if (ENABLE_DEV_DEBUG) {
|
|
85
|
+
console.log(
|
|
86
|
+
"[Dev Debug] No relinka config in dler config, using defaults"
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} catch {
|
|
91
|
+
const relinkaResult = await loadConfig({
|
|
92
|
+
name: "relinka",
|
|
93
|
+
cwd: process.cwd(),
|
|
94
|
+
dotenv: false,
|
|
95
|
+
packageJson: false,
|
|
96
|
+
rcFile: false,
|
|
97
|
+
globalRc: false,
|
|
98
|
+
defaults: DEFAULT_RELINKA_CONFIG
|
|
99
|
+
});
|
|
100
|
+
currentConfig = relinkaResult.config;
|
|
101
|
+
if (ENABLE_DEV_DEBUG) {
|
|
102
|
+
console.log(
|
|
103
|
+
"[Dev Debug] Dler config loading failed, using separate relinka config"
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
160
107
|
isConfigInitialized = true;
|
|
161
108
|
resolveRelinkaConfig?.(currentConfig);
|
|
162
109
|
resolveRelinkaConfig = void 0;
|
|
163
110
|
if (ENABLE_DEV_DEBUG) {
|
|
164
|
-
console.log("[Dev Debug] Config file used:", result.configFile);
|
|
165
|
-
console.log("[Dev Debug] All merged layers:", result.layers);
|
|
166
111
|
console.log("[Dev Debug] Final configuration:", currentConfig);
|
|
167
112
|
}
|
|
168
113
|
} catch (err) {
|
package/bin/mod.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { message, step, log, logger } from "./alias.js";
|
|
2
|
-
export type { RelinkaDirsConfig, LogLevelConfig, LogLevelsConfig, LogLevel, RelinkaConfig, LogFileInfo, RelinkaFunction, RelinkaConfigOptions, } from "./
|
|
2
|
+
export type { RelinkaDirsConfig, LogLevelConfig, LogLevelsConfig, LogLevel, RelinkaConfig, LogFileInfo, RelinkaFunction, RelinkaConfigOptions, } from "./setup.js";
|
|
3
3
|
export { loadRelinkaConfig, relinkaConfig, relinkaShutdown, flushAllLogBuffers, shouldNeverHappen, truncateString, casesHandled, relinka, relinkaAsync, defineConfig, formatBox, } from "./impl.js";
|
package/bin/setup.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { DefaultColorKeys } from "@reliverse/relico";
|
|
2
|
+
export declare const ENABLE_DEV_DEBUG = false;
|
|
3
|
+
export declare const EXIT_GUARD: unique symbol;
|
|
4
|
+
/** Configuration for directory-related settings. */
|
|
5
|
+
export type RelinkaDirsConfig = {
|
|
6
|
+
maxLogFiles?: number;
|
|
7
|
+
};
|
|
8
|
+
/** Configuration for a single log level. */
|
|
9
|
+
export type LogLevelConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* Symbol to display for this log level.
|
|
12
|
+
* @see https://symbl.cc
|
|
13
|
+
*/
|
|
14
|
+
symbol: string;
|
|
15
|
+
/**
|
|
16
|
+
* Fallback symbol to use if Unicode is not supported.
|
|
17
|
+
*/
|
|
18
|
+
fallbackSymbol: string;
|
|
19
|
+
/**
|
|
20
|
+
* Color to use for this log level.
|
|
21
|
+
*/
|
|
22
|
+
color: DefaultColorKeys;
|
|
23
|
+
/**
|
|
24
|
+
* Number of spaces after the symbol/fallback
|
|
25
|
+
*/
|
|
26
|
+
spacing?: number;
|
|
27
|
+
};
|
|
28
|
+
/** Configuration for all log levels. */
|
|
29
|
+
export type LogLevelsConfig = Partial<Record<LogLevel, LogLevelConfig>>;
|
|
30
|
+
/** Log level types used by the logger. */
|
|
31
|
+
export type LogLevel = "error" | "fatal" | "info" | "success" | "verbose" | "warn" | "log" | "internal" | "null" | "step" | "box" | "message";
|
|
32
|
+
/**
|
|
33
|
+
* Configuration options for the Relinka logger.
|
|
34
|
+
* All properties are optional to allow for partial configuration.
|
|
35
|
+
* Defaults will be applied during initialization.
|
|
36
|
+
*/
|
|
37
|
+
export type RelinkaConfig = {
|
|
38
|
+
/**
|
|
39
|
+
* Enables verbose (aka debug) mode for detailed logging.
|
|
40
|
+
*
|
|
41
|
+
* `true` here works only for end-users of CLIs/libs when theirs developers
|
|
42
|
+
* has been awaited for user's config via `@reliverse/relinka`'s `await relinkaConfig;`
|
|
43
|
+
*/
|
|
44
|
+
verbose?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Configuration for directory-related settings.
|
|
47
|
+
* - `maxLogFiles`: The maximum number of log files to keep before cleanup.
|
|
48
|
+
*/
|
|
49
|
+
dirs?: RelinkaDirsConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Disables color output in the console.
|
|
52
|
+
*/
|
|
53
|
+
disableColors?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Configuration for log file output.
|
|
56
|
+
*/
|
|
57
|
+
logFile?: {
|
|
58
|
+
/**
|
|
59
|
+
* Path to the log file.
|
|
60
|
+
*/
|
|
61
|
+
outputPath?: string;
|
|
62
|
+
/**
|
|
63
|
+
* How to handle date in the filename.
|
|
64
|
+
* - `disable`: No date prefix/suffix
|
|
65
|
+
* - `append-before`: Add date before the filename (e.g., "2024-01-15-log.txt")
|
|
66
|
+
* - `append-after`: Add date after the filename (e.g., "log-2024-01-15.txt")
|
|
67
|
+
*/
|
|
68
|
+
nameWithDate?: "disable" | "append-before" | "append-after";
|
|
69
|
+
/**
|
|
70
|
+
* If true, clears the log file when relinkaConfig is executed with supportFreshLogFile: true.
|
|
71
|
+
* This is useful for starting with a clean log file on each run.
|
|
72
|
+
*/
|
|
73
|
+
freshLogFile?: boolean;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* If true, logs will be saved to a file.
|
|
77
|
+
*/
|
|
78
|
+
saveLogsToFile?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Configuration for timestamp in log messages.
|
|
81
|
+
*/
|
|
82
|
+
timestamp?: {
|
|
83
|
+
/**
|
|
84
|
+
* If true, timestamps will be added to log messages.
|
|
85
|
+
*/
|
|
86
|
+
enabled: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The format for timestamps. Default is YYYY-MM-DD HH:mm:ss.SSS
|
|
89
|
+
*/
|
|
90
|
+
format?: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Allows to customize the log levels.
|
|
94
|
+
*/
|
|
95
|
+
levels?: LogLevelsConfig;
|
|
96
|
+
/**
|
|
97
|
+
* Controls how often the log cleanup runs (in milliseconds)
|
|
98
|
+
* Default: 10000 (10 seconds)
|
|
99
|
+
*/
|
|
100
|
+
cleanupInterval?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Maximum size of the log write buffer before flushing to disk (in bytes)
|
|
103
|
+
* Default: 4096 (4KB)
|
|
104
|
+
*/
|
|
105
|
+
bufferSize?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Maximum time to hold logs in buffer before flushing to disk (in milliseconds)
|
|
108
|
+
* Default: 5000 (5 seconds)
|
|
109
|
+
*/
|
|
110
|
+
maxBufferAge?: number;
|
|
111
|
+
};
|
|
112
|
+
/** Represents information about a log file for cleanup purposes. */
|
|
113
|
+
export type LogFileInfo = {
|
|
114
|
+
path: string;
|
|
115
|
+
mtime: number;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Default configuration object.
|
|
119
|
+
* `reconf` will merge this with a config file.
|
|
120
|
+
*/
|
|
121
|
+
export declare const DEFAULT_RELINKA_CONFIG: RelinkaConfig;
|
|
122
|
+
/**
|
|
123
|
+
* Enhanced relinka function type that supports both traditional and method syntax
|
|
124
|
+
*/
|
|
125
|
+
export type RelinkaFunction = {
|
|
126
|
+
(type: LogLevel | "clear", message: string, ...args: unknown[]): undefined | never;
|
|
127
|
+
error(message: string, ...args: unknown[]): void;
|
|
128
|
+
fatal(message: string, ...args: unknown[]): never;
|
|
129
|
+
info(message: string, ...args: unknown[]): void;
|
|
130
|
+
success(message: string, ...args: unknown[]): void;
|
|
131
|
+
verbose(message: string, ...args: unknown[]): void;
|
|
132
|
+
warn(message: string, ...args: unknown[]): void;
|
|
133
|
+
log(message: string, ...args: unknown[]): void;
|
|
134
|
+
internal(message: string, ...args: unknown[]): void;
|
|
135
|
+
null(message: string, ...args: unknown[]): void;
|
|
136
|
+
step(message: string, ...args: unknown[]): void;
|
|
137
|
+
box(message: string, ...args: unknown[]): void;
|
|
138
|
+
message(message: string, ...args: unknown[]): void;
|
|
139
|
+
clear(): void;
|
|
140
|
+
};
|
|
141
|
+
/** Options for relinkaConfig */
|
|
142
|
+
export type RelinkaConfigOptions = {
|
|
143
|
+
supportFreshLogFile?: boolean;
|
|
144
|
+
};
|
package/bin/setup.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const ENABLE_DEV_DEBUG = false;
|
|
2
|
+
export const EXIT_GUARD = Symbol.for("relinka.exitHandlersRegistered");
|
|
3
|
+
export const DEFAULT_RELINKA_CONFIG = {
|
|
4
|
+
verbose: false,
|
|
5
|
+
dirs: {
|
|
6
|
+
maxLogFiles: 0
|
|
7
|
+
},
|
|
8
|
+
disableColors: false,
|
|
9
|
+
logFile: {
|
|
10
|
+
outputPath: "logs.log",
|
|
11
|
+
nameWithDate: "disable",
|
|
12
|
+
freshLogFile: true
|
|
13
|
+
},
|
|
14
|
+
saveLogsToFile: false,
|
|
15
|
+
timestamp: {
|
|
16
|
+
enabled: false,
|
|
17
|
+
format: "YYYY-MM-DD HH:mm:ss.SSS"
|
|
18
|
+
},
|
|
19
|
+
cleanupInterval: 1e4,
|
|
20
|
+
// 10 seconds
|
|
21
|
+
bufferSize: 4096,
|
|
22
|
+
// 4KB
|
|
23
|
+
maxBufferAge: 5e3,
|
|
24
|
+
// 5 seconds
|
|
25
|
+
// A default set of levels, with fallback symbols for non-Unicode terminals:
|
|
26
|
+
levels: {
|
|
27
|
+
success: {
|
|
28
|
+
symbol: "\u2713",
|
|
29
|
+
fallbackSymbol: "[OK]",
|
|
30
|
+
color: "greenBright",
|
|
31
|
+
spacing: 3
|
|
32
|
+
},
|
|
33
|
+
info: {
|
|
34
|
+
symbol: "\u25C8",
|
|
35
|
+
fallbackSymbol: "[i]",
|
|
36
|
+
color: "cyanBright",
|
|
37
|
+
spacing: 3
|
|
38
|
+
},
|
|
39
|
+
error: {
|
|
40
|
+
symbol: "\u2716",
|
|
41
|
+
fallbackSymbol: "[ERR]",
|
|
42
|
+
color: "redBright",
|
|
43
|
+
spacing: 3
|
|
44
|
+
},
|
|
45
|
+
warn: {
|
|
46
|
+
symbol: "\u26A0",
|
|
47
|
+
fallbackSymbol: "[WARN]",
|
|
48
|
+
color: "yellowBright",
|
|
49
|
+
spacing: 3
|
|
50
|
+
},
|
|
51
|
+
fatal: {
|
|
52
|
+
symbol: "\u203C",
|
|
53
|
+
fallbackSymbol: "[FATAL]",
|
|
54
|
+
color: "redBright",
|
|
55
|
+
spacing: 3
|
|
56
|
+
},
|
|
57
|
+
verbose: {
|
|
58
|
+
symbol: "\u2731",
|
|
59
|
+
fallbackSymbol: "[VERBOSE]",
|
|
60
|
+
color: "gray",
|
|
61
|
+
spacing: 3
|
|
62
|
+
},
|
|
63
|
+
internal: {
|
|
64
|
+
symbol: "\u2699",
|
|
65
|
+
fallbackSymbol: "[INTERNAL]",
|
|
66
|
+
color: "magentaBright",
|
|
67
|
+
spacing: 3
|
|
68
|
+
},
|
|
69
|
+
log: { symbol: "\u2502", fallbackSymbol: "|", color: "dim", spacing: 3 },
|
|
70
|
+
step: {
|
|
71
|
+
symbol: "\u2192",
|
|
72
|
+
fallbackSymbol: "[STEP]",
|
|
73
|
+
color: "blueBright",
|
|
74
|
+
spacing: 3
|
|
75
|
+
},
|
|
76
|
+
box: {
|
|
77
|
+
symbol: "\u25A0",
|
|
78
|
+
fallbackSymbol: "[BOX]",
|
|
79
|
+
color: "whiteBright",
|
|
80
|
+
spacing: 1
|
|
81
|
+
},
|
|
82
|
+
message: {
|
|
83
|
+
symbol: "\u{1F7A0}",
|
|
84
|
+
fallbackSymbol: "[MSG]",
|
|
85
|
+
color: "cyan",
|
|
86
|
+
spacing: 3
|
|
87
|
+
},
|
|
88
|
+
null: { symbol: "", fallbackSymbol: "", color: "dim", spacing: 0 }
|
|
89
|
+
}
|
|
90
|
+
};
|