@powerlines/core 0.44.0 → 0.44.2
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/dist/constants/index.cjs +2 -2
- package/dist/constants/index.mjs +2 -2
- package/dist/constants/log-level.cjs +2 -2
- package/dist/constants/log-level.d.cts +2 -2
- package/dist/constants/log-level.d.mts +2 -2
- package/dist/constants/log-level.mjs +2 -2
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/index.cjs +7 -10
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +4 -4
- package/dist/lib/index.cjs +1 -7
- package/dist/lib/index.d.cts +1 -2
- package/dist/lib/index.d.mts +1 -2
- package/dist/lib/index.mjs +2 -3
- package/dist/lib/unplugin/plugin.cjs +9 -11
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +9 -11
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +1 -1
- package/dist/lib/utilities/index.mjs +1 -1
- package/dist/lib/utilities/write-file.d.cts +1 -1
- package/dist/lib/utilities/write-file.d.mts +1 -1
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +15 -2
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +3 -3
- package/dist/plugin-utils/logging.cjs +421 -4
- package/dist/plugin-utils/logging.d.cts +77 -3
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +77 -3
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +407 -4
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +1 -1
- package/dist/plugin-utils/paths.mjs +1 -1
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/types/config.d.cts +11 -4
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +11 -4
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +17 -28
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +17 -28
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +3 -0
- package/dist/types/logging.cjs +48 -0
- package/dist/types/logging.d.cts +175 -0
- package/dist/types/logging.d.cts.map +1 -0
- package/dist/types/logging.d.mts +175 -0
- package/dist/types/logging.d.mts.map +1 -0
- package/dist/types/logging.mjs +45 -0
- package/dist/types/logging.mjs.map +1 -0
- package/package.json +74 -442
- package/dist/lib/logger.cjs +0 -106
- package/dist/lib/logger.d.cts +0 -42
- package/dist/lib/logger.d.cts.map +0 -1
- package/dist/lib/logger.d.mts +0 -42
- package/dist/lib/logger.d.mts.map +0 -1
- package/dist/lib/logger.mjs +0 -100
- package/dist/lib/logger.mjs.map +0 -1
- package/dist/types/log.cjs +0 -26
- package/dist/types/log.d.cts +0 -90
- package/dist/types/log.d.cts.map +0 -1
- package/dist/types/log.d.mts +0 -90
- package/dist/types/log.d.mts.map +0 -1
- package/dist/types/log.mjs +0 -25
- package/dist/types/log.mjs.map +0 -1
package/dist/lib/logger.cjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_environments = require('../constants/environments.cjs');
|
|
4
|
-
const require_plugin_utils_logging = require('../plugin-utils/logging.cjs');
|
|
5
|
-
require('../plugin-utils/index.cjs');
|
|
6
|
-
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
7
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
|
-
let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
9
|
-
let _storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
|
|
10
|
-
let _stryke_helpers_noop = require("@stryke/helpers/noop");
|
|
11
|
-
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
12
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
13
|
-
let chalk = require("chalk");
|
|
14
|
-
chalk = require_runtime.__toESM(chalk, 1);
|
|
15
|
-
|
|
16
|
-
//#region src/lib/logger.ts
|
|
17
|
-
const BADGE_COLORS = [
|
|
18
|
-
"#00A0DD",
|
|
19
|
-
"#6FCE4E",
|
|
20
|
-
"#FBBF24",
|
|
21
|
-
"#F43F5E",
|
|
22
|
-
"#3B82F6",
|
|
23
|
-
"#A855F7",
|
|
24
|
-
"#469592",
|
|
25
|
-
"#288EDF",
|
|
26
|
-
"#D8B4FE",
|
|
27
|
-
"#10B981",
|
|
28
|
-
"#EF4444",
|
|
29
|
-
"#F0EC56",
|
|
30
|
-
"#F472B6",
|
|
31
|
-
"#22D3EE",
|
|
32
|
-
"#EAB308",
|
|
33
|
-
"#84CC16",
|
|
34
|
-
"#F87171",
|
|
35
|
-
"#0EA5E9",
|
|
36
|
-
"#D946EF",
|
|
37
|
-
"#FACC15",
|
|
38
|
-
"#34D399",
|
|
39
|
-
"#8B5CF6"
|
|
40
|
-
];
|
|
41
|
-
/**
|
|
42
|
-
* Generate a consistent color based on the input text.
|
|
43
|
-
*
|
|
44
|
-
* @param text - The input text to generate the color from.
|
|
45
|
-
* @return A hexadecimal color string.
|
|
46
|
-
*/
|
|
47
|
-
const getTextColor = (text) => {
|
|
48
|
-
return BADGE_COLORS[text.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0];
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Generate a consistent color based on the input text.
|
|
52
|
-
*
|
|
53
|
-
* @param text - The input text to generate the color from.
|
|
54
|
-
* @return A hexadecimal color string.
|
|
55
|
-
*/
|
|
56
|
-
const colorText = (text) => {
|
|
57
|
-
const title = (0, _stryke_string_format_title_case.titleCase)(text);
|
|
58
|
-
return chalk.default.hex(getTextColor(title))(title);
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Generate a consistent color based on the input text.
|
|
62
|
-
*
|
|
63
|
-
* @param text - The input text to generate the color from.
|
|
64
|
-
* @return A hexadecimal color string.
|
|
65
|
-
*/
|
|
66
|
-
const colorBackground = (text) => {
|
|
67
|
-
const title = (0, _stryke_string_format_title_case.titleCase)(text);
|
|
68
|
-
return chalk.default.inverse.hex(getTextColor(title))(` ${title} `);
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Create a logging function with a specific name and options.
|
|
72
|
-
*
|
|
73
|
-
* @param config - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.
|
|
74
|
-
* @returns A logging function.
|
|
75
|
-
*/
|
|
76
|
-
const createLogFn = (config) => {
|
|
77
|
-
if (config.logLevel === "silent") return _stryke_helpers_noop.noop;
|
|
78
|
-
const logLevel = require_plugin_utils_logging.resolveLogLevel(config.logLevel || "info", config.mode);
|
|
79
|
-
return (meta, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)((0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : meta.level), {
|
|
80
|
-
...config,
|
|
81
|
-
logLevel: logLevel[(0, _stryke_type_checks_is_set_object.isSetObject)(meta) && (0, _stryke_type_checks_is_set_string.isSetString)(meta.category) ? meta.category : (0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : "general"]
|
|
82
|
-
})(`${config.source ? chalk.default.bold.hex((0, _storm_software_config_tools_utilities_colors.getColor)("brand", config))((0, _stryke_string_format_kebab_case.kebabCase)(config.source)) : ""}${config.command ? chalk.default.hex((0, _storm_software_config_tools_utilities_colors.getColor)("brand", config))(` (${config.command})`) : ""}${config.source ? chalk.default.grey(" > ") : ""}${config.plugin && (!config.source || (0, _stryke_string_format_kebab_case.kebabCase)(config.plugin) !== (0, _stryke_string_format_kebab_case.kebabCase)(config.source)) ? `${chalk.default.bold.hex((0, _storm_software_config_tools_utilities_colors.getColor)("brand", config))((0, _stryke_string_format_kebab_case.kebabCase)(config.plugin))}${chalk.default.grey(" > ")}` : ""}${config.environment && config.environment !== "default" ? `${chalk.default.bold.hex((0, _storm_software_config_tools_utilities_colors.getColor)("brand", config))((0, _stryke_string_format_kebab_case.kebabCase)(config.environment))}${chalk.default.grey(" > ")}` : ""}${args.join(" ")} `.trim());
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Extend a logging function with a specific name, adding a colored badge to the log output.
|
|
86
|
-
*
|
|
87
|
-
* @param logFn - The original logging function to extend.
|
|
88
|
-
* @param config - The overlay metadata to use for the badge in the log output.
|
|
89
|
-
* @returns A new logging function that includes the badge in its output.
|
|
90
|
-
*/
|
|
91
|
-
const extendLogFn = (logFn, config) => {
|
|
92
|
-
return (meta, ...args) => config.source || config.category ? logFn((0, _stryke_type_checks_is_set_object.isSetObject)(meta) ? {
|
|
93
|
-
...config,
|
|
94
|
-
...meta
|
|
95
|
-
} : {
|
|
96
|
-
...config,
|
|
97
|
-
level: meta
|
|
98
|
-
}, `${colorBackground(String(config.source || config.category))} ${args.filter(Boolean).map((arg) => String(arg).trim()).join(" ")} `) : logFn(meta, ...args);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
//#endregion
|
|
102
|
-
exports.colorBackground = colorBackground;
|
|
103
|
-
exports.colorText = colorText;
|
|
104
|
-
exports.createLogFn = createLogFn;
|
|
105
|
-
exports.extendLogFn = extendLogFn;
|
|
106
|
-
exports.getTextColor = getTextColor;
|
package/dist/lib/logger.d.cts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { LogFn, LogFnConfig } from "../types/log.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/logger.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Generate a consistent color based on the input text.
|
|
6
|
-
*
|
|
7
|
-
* @param text - The input text to generate the color from.
|
|
8
|
-
* @return A hexadecimal color string.
|
|
9
|
-
*/
|
|
10
|
-
declare const getTextColor: (text: string) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Generate a consistent color based on the input text.
|
|
13
|
-
*
|
|
14
|
-
* @param text - The input text to generate the color from.
|
|
15
|
-
* @return A hexadecimal color string.
|
|
16
|
-
*/
|
|
17
|
-
declare const colorText: (text: string) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Generate a consistent color based on the input text.
|
|
20
|
-
*
|
|
21
|
-
* @param text - The input text to generate the color from.
|
|
22
|
-
* @return A hexadecimal color string.
|
|
23
|
-
*/
|
|
24
|
-
declare const colorBackground: (text: string) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Create a logging function with a specific name and options.
|
|
27
|
-
*
|
|
28
|
-
* @param config - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.
|
|
29
|
-
* @returns A logging function.
|
|
30
|
-
*/
|
|
31
|
-
declare const createLogFn: (config: LogFnConfig) => LogFn;
|
|
32
|
-
/**
|
|
33
|
-
* Extend a logging function with a specific name, adding a colored badge to the log output.
|
|
34
|
-
*
|
|
35
|
-
* @param logFn - The original logging function to extend.
|
|
36
|
-
* @param config - The overlay metadata to use for the badge in the log output.
|
|
37
|
-
* @returns A new logging function that includes the badge in its output.
|
|
38
|
-
*/
|
|
39
|
-
declare const extendLogFn: (logFn: LogFn, config: LogFnConfig) => LogFn;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { colorBackground, colorText, createLogFn, extendLogFn, getTextColor };
|
|
42
|
-
//# sourceMappingURL=logger.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.cts","names":[],"sources":["../../src/lib/logger.ts"],"mappings":";;;;;AA6DA;;;;cAAa,YAAA,GAAgB,IAAA;AAiB7B;;;;;AAYA;AAZA,cAAa,SAAA,GAAa,IAAA;;;;AAwB1B;;;cAZa,eAAA,GAAmB,IAAA;;;;;;AAgEhC;cApDa,WAAA,GAAe,MAAA,EAAQ,WAAA,KAAc,KAAA;;;;;;;;cAoDrC,WAAA,GAAe,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,WAAA,KAAc,KAAA"}
|
package/dist/lib/logger.d.mts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { LogFn, LogFnConfig } from "../types/log.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/lib/logger.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Generate a consistent color based on the input text.
|
|
6
|
-
*
|
|
7
|
-
* @param text - The input text to generate the color from.
|
|
8
|
-
* @return A hexadecimal color string.
|
|
9
|
-
*/
|
|
10
|
-
declare const getTextColor: (text: string) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Generate a consistent color based on the input text.
|
|
13
|
-
*
|
|
14
|
-
* @param text - The input text to generate the color from.
|
|
15
|
-
* @return A hexadecimal color string.
|
|
16
|
-
*/
|
|
17
|
-
declare const colorText: (text: string) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Generate a consistent color based on the input text.
|
|
20
|
-
*
|
|
21
|
-
* @param text - The input text to generate the color from.
|
|
22
|
-
* @return A hexadecimal color string.
|
|
23
|
-
*/
|
|
24
|
-
declare const colorBackground: (text: string) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Create a logging function with a specific name and options.
|
|
27
|
-
*
|
|
28
|
-
* @param config - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.
|
|
29
|
-
* @returns A logging function.
|
|
30
|
-
*/
|
|
31
|
-
declare const createLogFn: (config: LogFnConfig) => LogFn;
|
|
32
|
-
/**
|
|
33
|
-
* Extend a logging function with a specific name, adding a colored badge to the log output.
|
|
34
|
-
*
|
|
35
|
-
* @param logFn - The original logging function to extend.
|
|
36
|
-
* @param config - The overlay metadata to use for the badge in the log output.
|
|
37
|
-
* @returns A new logging function that includes the badge in its output.
|
|
38
|
-
*/
|
|
39
|
-
declare const extendLogFn: (logFn: LogFn, config: LogFnConfig) => LogFn;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { colorBackground, colorText, createLogFn, extendLogFn, getTextColor };
|
|
42
|
-
//# sourceMappingURL=logger.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.mts","names":[],"sources":["../../src/lib/logger.ts"],"mappings":";;;;;AA6DA;;;;cAAa,YAAA,GAAgB,IAAA;AAiB7B;;;;;AAYA;AAZA,cAAa,SAAA,GAAa,IAAA;;;;AAwB1B;;;cAZa,eAAA,GAAmB,IAAA;;;;;;AAgEhC;cApDa,WAAA,GAAe,MAAA,EAAQ,WAAA,KAAc,KAAA;;;;;;;;cAoDrC,WAAA,GAAe,KAAA,EAAO,KAAA,EAAO,MAAA,EAAQ,WAAA,KAAc,KAAA"}
|
package/dist/lib/logger.mjs
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ENVIRONMENT } from "../constants/environments.mjs";
|
|
2
|
-
import { resolveLogLevel } from "../plugin-utils/logging.mjs";
|
|
3
|
-
import "../plugin-utils/index.mjs";
|
|
4
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
5
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
6
|
-
import { getLogFn, getLogLevel } from "@storm-software/config-tools/logger";
|
|
7
|
-
import { getColor } from "@storm-software/config-tools/utilities/colors";
|
|
8
|
-
import { noop } from "@stryke/helpers/noop";
|
|
9
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
10
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
11
|
-
import chalk from "chalk";
|
|
12
|
-
|
|
13
|
-
//#region src/lib/logger.ts
|
|
14
|
-
const BADGE_COLORS = [
|
|
15
|
-
"#00A0DD",
|
|
16
|
-
"#6FCE4E",
|
|
17
|
-
"#FBBF24",
|
|
18
|
-
"#F43F5E",
|
|
19
|
-
"#3B82F6",
|
|
20
|
-
"#A855F7",
|
|
21
|
-
"#469592",
|
|
22
|
-
"#288EDF",
|
|
23
|
-
"#D8B4FE",
|
|
24
|
-
"#10B981",
|
|
25
|
-
"#EF4444",
|
|
26
|
-
"#F0EC56",
|
|
27
|
-
"#F472B6",
|
|
28
|
-
"#22D3EE",
|
|
29
|
-
"#EAB308",
|
|
30
|
-
"#84CC16",
|
|
31
|
-
"#F87171",
|
|
32
|
-
"#0EA5E9",
|
|
33
|
-
"#D946EF",
|
|
34
|
-
"#FACC15",
|
|
35
|
-
"#34D399",
|
|
36
|
-
"#8B5CF6"
|
|
37
|
-
];
|
|
38
|
-
/**
|
|
39
|
-
* Generate a consistent color based on the input text.
|
|
40
|
-
*
|
|
41
|
-
* @param text - The input text to generate the color from.
|
|
42
|
-
* @return A hexadecimal color string.
|
|
43
|
-
*/
|
|
44
|
-
const getTextColor = (text) => {
|
|
45
|
-
return BADGE_COLORS[text.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0];
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Generate a consistent color based on the input text.
|
|
49
|
-
*
|
|
50
|
-
* @param text - The input text to generate the color from.
|
|
51
|
-
* @return A hexadecimal color string.
|
|
52
|
-
*/
|
|
53
|
-
const colorText = (text) => {
|
|
54
|
-
const title = titleCase(text);
|
|
55
|
-
return chalk.hex(getTextColor(title))(title);
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Generate a consistent color based on the input text.
|
|
59
|
-
*
|
|
60
|
-
* @param text - The input text to generate the color from.
|
|
61
|
-
* @return A hexadecimal color string.
|
|
62
|
-
*/
|
|
63
|
-
const colorBackground = (text) => {
|
|
64
|
-
const title = titleCase(text);
|
|
65
|
-
return chalk.inverse.hex(getTextColor(title))(` ${title} `);
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Create a logging function with a specific name and options.
|
|
69
|
-
*
|
|
70
|
-
* @param config - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.
|
|
71
|
-
* @returns A logging function.
|
|
72
|
-
*/
|
|
73
|
-
const createLogFn = (config) => {
|
|
74
|
-
if (config.logLevel === "silent") return noop;
|
|
75
|
-
const logLevel = resolveLogLevel(config.logLevel || "info", config.mode);
|
|
76
|
-
return (meta, ...args) => getLogFn(getLogLevel(isSetString(meta) ? meta : meta.level), {
|
|
77
|
-
...config,
|
|
78
|
-
logLevel: logLevel[isSetObject(meta) && isSetString(meta.category) ? meta.category : isSetString(meta) ? meta : "general"]
|
|
79
|
-
})(`${config.source ? chalk.bold.hex(getColor("brand", config))(kebabCase(config.source)) : ""}${config.command ? chalk.hex(getColor("brand", config))(` (${config.command})`) : ""}${config.source ? chalk.grey(" > ") : ""}${config.plugin && (!config.source || kebabCase(config.plugin) !== kebabCase(config.source)) ? `${chalk.bold.hex(getColor("brand", config))(kebabCase(config.plugin))}${chalk.grey(" > ")}` : ""}${config.environment && config.environment !== "default" ? `${chalk.bold.hex(getColor("brand", config))(kebabCase(config.environment))}${chalk.grey(" > ")}` : ""}${args.join(" ")} `.trim());
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Extend a logging function with a specific name, adding a colored badge to the log output.
|
|
83
|
-
*
|
|
84
|
-
* @param logFn - The original logging function to extend.
|
|
85
|
-
* @param config - The overlay metadata to use for the badge in the log output.
|
|
86
|
-
* @returns A new logging function that includes the badge in its output.
|
|
87
|
-
*/
|
|
88
|
-
const extendLogFn = (logFn, config) => {
|
|
89
|
-
return (meta, ...args) => config.source || config.category ? logFn(isSetObject(meta) ? {
|
|
90
|
-
...config,
|
|
91
|
-
...meta
|
|
92
|
-
} : {
|
|
93
|
-
...config,
|
|
94
|
-
level: meta
|
|
95
|
-
}, `${colorBackground(String(config.source || config.category))} ${args.filter(Boolean).map((arg) => String(arg).trim()).join(" ")} `) : logFn(meta, ...args);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
//#endregion
|
|
99
|
-
export { colorBackground, colorText, createLogFn, extendLogFn, getTextColor };
|
|
100
|
-
//# sourceMappingURL=logger.mjs.map
|
package/dist/lib/logger.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.mjs","names":[],"sources":["../../src/lib/logger.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { noop } from \"@stryke/helpers/noop\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport chalk from \"chalk\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport { resolveLogLevel } from \"../plugin-utils\";\nimport type { LogFn, LogFnConfig } from \"../types/log\";\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const getTextColor = (text: string): string => {\n return (\n BADGE_COLORS[\n text\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n );\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorText = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.hex(getTextColor(title))(title);\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorBackground = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.inverse.hex(getTextColor(title))(` ${title} `);\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param config - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogFn = (config: LogFnConfig): LogFn => {\n if (config.logLevel === \"silent\") {\n return noop;\n }\n\n const logLevel = resolveLogLevel(config.logLevel || \"info\", config.mode);\n\n return (meta, ...args) =>\n getLogFn(getLogLevel(isSetString(meta) ? meta : meta.level), {\n ...config,\n logLevel:\n logLevel[\n (isSetObject(meta) && isSetString(meta.category)\n ? meta.category\n : isSetString(meta)\n ? meta\n : \"general\") as keyof typeof logLevel\n ]\n })(\n `${\n config.source\n ? chalk.bold.hex(getColor(\"brand\", config))(kebabCase(config.source))\n : \"\"\n }${\n config.command\n ? chalk.hex(getColor(\"brand\", config))(` (${config.command})`)\n : \"\"\n }${config.source ? chalk.grey(\" > \") : \"\"}${\n config.plugin &&\n (!config.source ||\n kebabCase(config.plugin) !== kebabCase(config.source))\n ? `${chalk.bold.hex(getColor(\"brand\", config))(\n kebabCase(config.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n config.environment && config.environment !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(getColor(\"brand\", config))(\n kebabCase(config.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n};\n\n/**\n * Extend a logging function with a specific name, adding a colored badge to the log output.\n *\n * @param logFn - The original logging function to extend.\n * @param config - The overlay metadata to use for the badge in the log output.\n * @returns A new logging function that includes the badge in its output.\n */\nexport const extendLogFn = (logFn: LogFn, config: LogFnConfig): LogFn => {\n return (meta, ...args) =>\n config.source || config.category\n ? logFn(\n isSetObject(meta)\n ? { ...config, ...meta }\n : { ...config, level: meta },\n `${colorBackground(String(config.source || config.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n"],"mappings":";;;;;;;;;;;;;AA8BA,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;AAQD,MAAa,gBAAgB,SAAyB;AACpD,QACE,aACE,KACG,MAAM,GAAG,CACT,KAAI,SAAQ,KAAK,WAAW,EAAE,CAAC,CAC/B,QAAQ,KAAK,aAAa,MAAM,UAAU,EAAE,GAAG,aAAa,WAC5D,aAAa;;;;;;;;AAUtB,MAAa,aAAa,SAAyB;CACjD,MAAM,QAAQ,UAAU,KAAK;AAE7B,QAAO,MAAM,IAAI,aAAa,MAAM,CAAC,CAAC,MAAM;;;;;;;;AAS9C,MAAa,mBAAmB,SAAyB;CACvD,MAAM,QAAQ,UAAU,KAAK;AAE7B,QAAO,MAAM,QAAQ,IAAI,aAAa,MAAM,CAAC,CAAC,IAAI,MAAM,GAAG;;;;;;;;AAS7D,MAAa,eAAe,WAA+B;AACzD,KAAI,OAAO,aAAa,SACtB,QAAO;CAGT,MAAM,WAAW,gBAAgB,OAAO,YAAY,QAAQ,OAAO,KAAK;AAExE,SAAQ,MAAM,GAAG,SACf,SAAS,YAAY,YAAY,KAAK,GAAG,OAAO,KAAK,MAAM,EAAE;EAC3D,GAAG;EACH,UACE,SACG,YAAY,KAAK,IAAI,YAAY,KAAK,SAAS,GAC5C,KAAK,WACL,YAAY,KAAK,GACf,OACA;EAEX,CAAC,CACA,GACE,OAAO,SACH,MAAM,KAAK,IAAI,SAAS,SAAS,OAAO,CAAC,CAAC,UAAU,OAAO,OAAO,CAAC,GACnE,KAEJ,OAAO,UACH,MAAM,IAAI,SAAS,SAAS,OAAO,CAAC,CAAC,KAAK,OAAO,QAAQ,GAAG,GAC5D,KACH,OAAO,SAAS,MAAM,KAAK,MAAM,GAAG,KACrC,OAAO,WACN,CAAC,OAAO,UACP,UAAU,OAAO,OAAO,KAAK,UAAU,OAAO,OAAO,IACnD,GAAG,MAAM,KAAK,IAAI,SAAS,SAAS,OAAO,CAAC,CAC1C,UAAU,OAAO,OAAO,CACzB,GAAG,MAAM,KAAK,MAAM,KACrB,KAEJ,OAAO,eAAe,OAAO,4BACzB,GAAG,MAAM,KAAK,IAAI,SAAS,SAAS,OAAO,CAAC,CAC1C,UAAU,OAAO,YAAY,CAC9B,GAAG,MAAM,KAAK,MAAM,KACrB,KACH,KAAK,KAAK,IAAI,CAAC,GAAG,MAAM,CAC5B;;;;;;;;;AAUL,MAAa,eAAe,OAAc,WAA+B;AACvE,SAAQ,MAAM,GAAG,SACf,OAAO,UAAU,OAAO,WACpB,MACE,YAAY,KAAK,GACb;EAAE,GAAG;EAAQ,GAAG;EAAM,GACtB;EAAE,GAAG;EAAQ,OAAO;EAAM,EAC9B,GAAG,gBAAgB,OAAO,OAAO,UAAU,OAAO,SAAS,CAAC,CAAC,GAAG,KAC7D,OAAO,QAAQ,CACf,KAAI,QAAO,OAAO,IAAI,CAAC,MAAM,CAAC,CAC9B,KAAK,IAAI,CAAC,GACd,GACD,MAAM,MAAM,GAAG,KAAK"}
|
package/dist/types/log.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/types/log.ts
|
|
3
|
-
const LogLevels = {
|
|
4
|
-
SILENT: "silent",
|
|
5
|
-
ERROR: "error",
|
|
6
|
-
WARN: "warn",
|
|
7
|
-
INFO: "info",
|
|
8
|
-
DEBUG: "debug",
|
|
9
|
-
TRACE: "trace"
|
|
10
|
-
};
|
|
11
|
-
const LogCategories = {
|
|
12
|
-
GENERAL: "general",
|
|
13
|
-
FS: "fs",
|
|
14
|
-
PERFORMANCE: "performance",
|
|
15
|
-
CONFIG: "config",
|
|
16
|
-
PLUGINS: "plugins",
|
|
17
|
-
HOOKS: "hooks",
|
|
18
|
-
ENV: "env",
|
|
19
|
-
IPC: "ipc",
|
|
20
|
-
BABEL: "babel",
|
|
21
|
-
NETWORK: "network"
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
exports.LogCategories = LogCategories;
|
|
26
|
-
exports.LogLevels = LogLevels;
|
package/dist/types/log.d.cts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { BaseContext } from "./context.cjs";
|
|
2
|
-
import { Mode, WorkspaceConfig } from "./config.cjs";
|
|
3
|
-
import { PartialKeys, RequiredKeys } from "@stryke/types/base";
|
|
4
|
-
|
|
5
|
-
//#region src/types/log.d.ts
|
|
6
|
-
type LogLevel = "silent" | "error" | "warn" | "info" | "debug" | "trace";
|
|
7
|
-
type LogCategory = "general" | "fs" | "performance" | "config" | "plugins" | "hooks" | "env" | "ipc" | "babel" | "network";
|
|
8
|
-
declare const LogLevels: {
|
|
9
|
-
readonly SILENT: "silent";
|
|
10
|
-
readonly ERROR: "error";
|
|
11
|
-
readonly WARN: "warn";
|
|
12
|
-
readonly INFO: "info";
|
|
13
|
-
readonly DEBUG: "debug";
|
|
14
|
-
readonly TRACE: "trace";
|
|
15
|
-
};
|
|
16
|
-
declare const LogCategories: {
|
|
17
|
-
readonly GENERAL: "general";
|
|
18
|
-
readonly FS: "fs";
|
|
19
|
-
readonly PERFORMANCE: "performance";
|
|
20
|
-
readonly CONFIG: "config";
|
|
21
|
-
readonly PLUGINS: "plugins";
|
|
22
|
-
readonly HOOKS: "hooks";
|
|
23
|
-
readonly ENV: "env";
|
|
24
|
-
readonly IPC: "ipc";
|
|
25
|
-
readonly BABEL: "babel";
|
|
26
|
-
readonly NETWORK: "network";
|
|
27
|
-
};
|
|
28
|
-
interface LogMeta {
|
|
29
|
-
/**
|
|
30
|
-
* A unique identifier for the log message, which can be used to correlate related log entries across different parts of the system or different executions.
|
|
31
|
-
*/
|
|
32
|
-
logId: string;
|
|
33
|
-
/**
|
|
34
|
-
* The log level label indicating the severity of the log message.
|
|
35
|
-
*/
|
|
36
|
-
level: LogLevel;
|
|
37
|
-
/**
|
|
38
|
-
* The category of the log message, which can be used to classify and filter log entries based on their purpose or origin.
|
|
39
|
-
*/
|
|
40
|
-
category: LogCategory;
|
|
41
|
-
/**
|
|
42
|
-
* The timestamp when the IPC message was created, represented as the number of milliseconds since the Unix epoch.
|
|
43
|
-
*/
|
|
44
|
-
timestamp: number;
|
|
45
|
-
/**
|
|
46
|
-
* A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
47
|
-
*/
|
|
48
|
-
executionId?: string;
|
|
49
|
-
/**
|
|
50
|
-
* The zero-based index of the current execution within the sequence of executions in the same process.
|
|
51
|
-
*/
|
|
52
|
-
executionIndex?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Optional environment identifier to specify the context or environment in which the message is being processed.
|
|
55
|
-
*/
|
|
56
|
-
environment?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Optional plugin name to specify the source plugin of the log message.
|
|
59
|
-
*/
|
|
60
|
-
plugin?: string;
|
|
61
|
-
/**
|
|
62
|
-
* The name of the logger or source of the log message, which can be used to identify the origin of the log entry.
|
|
63
|
-
*/
|
|
64
|
-
source?: string;
|
|
65
|
-
}
|
|
66
|
-
type Logger = (meta: LogMeta, ...args: string[]) => void;
|
|
67
|
-
type LogFnConfig = Omit<Partial<LogMeta>, "logId" | "level" | "timestamp"> & {
|
|
68
|
-
mode?: Mode;
|
|
69
|
-
command?: string;
|
|
70
|
-
logLevel?: LogLevelUserConfig | LogLevelResolvedConfig;
|
|
71
|
-
colors?: WorkspaceConfig["colors"];
|
|
72
|
-
};
|
|
73
|
-
type LogFnMeta = LogLevel | PartialKeys<LogMeta, "logId" | "category" | "timestamp">;
|
|
74
|
-
type LogFn = (meta: LogFnMeta, ...args: string[]) => void;
|
|
75
|
-
type CreateLoggerFunction<TContext extends BaseContext = BaseContext> = (context: TContext) => Logger;
|
|
76
|
-
type LogLevelUserConfig = LogLevel | RequiredKeys<Record<LogCategory, LogLevel | boolean | undefined>, "general">;
|
|
77
|
-
type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;
|
|
78
|
-
declare type __ΩLogLevel = any[];
|
|
79
|
-
declare type __ΩLogCategory = any[];
|
|
80
|
-
declare type __ΩLogMeta = any[];
|
|
81
|
-
declare type __ΩLogger = any[];
|
|
82
|
-
declare type __ΩLogFnConfig = any[];
|
|
83
|
-
declare type __ΩLogFnMeta = any[];
|
|
84
|
-
declare type __ΩLogFn = any[];
|
|
85
|
-
declare type __ΩCreateLoggerFunction = any[];
|
|
86
|
-
declare type __ΩLogLevelUserConfig = any[];
|
|
87
|
-
declare type __ΩLogLevelResolvedConfig = any[];
|
|
88
|
-
//#endregion
|
|
89
|
-
export { CreateLoggerFunction, LogCategories, LogCategory, LogFn, LogFnConfig, LogFnMeta, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMeta, Logger, __ΩCreateLoggerFunction, __ΩLogCategory, __ΩLogFn, __ΩLogFnConfig, __ΩLogFnMeta, __ΩLogLevel, __ΩLogLevelResolvedConfig, __ΩLogLevelUserConfig, __ΩLogMeta, __ΩLogger };
|
|
90
|
-
//# sourceMappingURL=log.d.cts.map
|
package/dist/types/log.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.cts","names":[],"sources":["../../src/types/log.ts"],"mappings":";;;;;KAsBY,QAAA;AAAA,KAEA,WAAA;AAAA,cAYC,SAAA;EAAA;;;;;;;cASA,aAAA;EAAA;;;;;;;;;;;UAaI,OAAA;;AAbjB;;EAiBE,KAAA;EANQ;;;EAUR,KAAA,EAAO,QAAA;;;;EAIP,QAAA,EAAU,WAAA;;;;EAIV,SAAA;;AAhBF;;EAoBE,WAAA;EARqB;;;EAYrB,cAAA;EAZA;;;EAgBA,WAAA;EAJA;;;EAQA,MAAA;EAIM;;AAGR;EAHE,MAAA;AAAA;AAAA,KAGU,MAAA,IAAU,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,KAE5B,WAAA,GAAc,IAAA,CACxB,OAAA,CAAQ,OAAA;EAGR,IAAA,GAAO,IAAA;EACP,OAAA;EACA,QAAA,GAAW,kBAAA,GAAqB,sBAAA;EAChC,MAAA,GAAS,eAAA;AAAA;AAAA,KAGC,SAAA,GACR,QAAA,GACA,WAAA,CAAY,OAAA;AAAA,KAEJ,KAAA,IAAS,IAAA,EAAM,SAAA,KAAc,IAAA;AAAA,KAE7B,oBAAA,kBAAsC,WAAA,GAAc,WAAA,KAC9D,OAAA,EAAS,QAAA,KACN,MAAA;AAAA,KAEO,kBAAA,GACR,QAAA,GACA,YAAA,CACE,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA,KAId,sBAAA,GAAyB,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA"}
|
package/dist/types/log.d.mts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { BaseContext } from "./context.mjs";
|
|
2
|
-
import { Mode, WorkspaceConfig } from "./config.mjs";
|
|
3
|
-
import { PartialKeys, RequiredKeys } from "@stryke/types/base";
|
|
4
|
-
|
|
5
|
-
//#region src/types/log.d.ts
|
|
6
|
-
type LogLevel = "silent" | "error" | "warn" | "info" | "debug" | "trace";
|
|
7
|
-
type LogCategory = "general" | "fs" | "performance" | "config" | "plugins" | "hooks" | "env" | "ipc" | "babel" | "network";
|
|
8
|
-
declare const LogLevels: {
|
|
9
|
-
readonly SILENT: "silent";
|
|
10
|
-
readonly ERROR: "error";
|
|
11
|
-
readonly WARN: "warn";
|
|
12
|
-
readonly INFO: "info";
|
|
13
|
-
readonly DEBUG: "debug";
|
|
14
|
-
readonly TRACE: "trace";
|
|
15
|
-
};
|
|
16
|
-
declare const LogCategories: {
|
|
17
|
-
readonly GENERAL: "general";
|
|
18
|
-
readonly FS: "fs";
|
|
19
|
-
readonly PERFORMANCE: "performance";
|
|
20
|
-
readonly CONFIG: "config";
|
|
21
|
-
readonly PLUGINS: "plugins";
|
|
22
|
-
readonly HOOKS: "hooks";
|
|
23
|
-
readonly ENV: "env";
|
|
24
|
-
readonly IPC: "ipc";
|
|
25
|
-
readonly BABEL: "babel";
|
|
26
|
-
readonly NETWORK: "network";
|
|
27
|
-
};
|
|
28
|
-
interface LogMeta {
|
|
29
|
-
/**
|
|
30
|
-
* A unique identifier for the log message, which can be used to correlate related log entries across different parts of the system or different executions.
|
|
31
|
-
*/
|
|
32
|
-
logId: string;
|
|
33
|
-
/**
|
|
34
|
-
* The log level label indicating the severity of the log message.
|
|
35
|
-
*/
|
|
36
|
-
level: LogLevel;
|
|
37
|
-
/**
|
|
38
|
-
* The category of the log message, which can be used to classify and filter log entries based on their purpose or origin.
|
|
39
|
-
*/
|
|
40
|
-
category: LogCategory;
|
|
41
|
-
/**
|
|
42
|
-
* The timestamp when the IPC message was created, represented as the number of milliseconds since the Unix epoch.
|
|
43
|
-
*/
|
|
44
|
-
timestamp: number;
|
|
45
|
-
/**
|
|
46
|
-
* A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
47
|
-
*/
|
|
48
|
-
executionId?: string;
|
|
49
|
-
/**
|
|
50
|
-
* The zero-based index of the current execution within the sequence of executions in the same process.
|
|
51
|
-
*/
|
|
52
|
-
executionIndex?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Optional environment identifier to specify the context or environment in which the message is being processed.
|
|
55
|
-
*/
|
|
56
|
-
environment?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Optional plugin name to specify the source plugin of the log message.
|
|
59
|
-
*/
|
|
60
|
-
plugin?: string;
|
|
61
|
-
/**
|
|
62
|
-
* The name of the logger or source of the log message, which can be used to identify the origin of the log entry.
|
|
63
|
-
*/
|
|
64
|
-
source?: string;
|
|
65
|
-
}
|
|
66
|
-
type Logger = (meta: LogMeta, ...args: string[]) => void;
|
|
67
|
-
type LogFnConfig = Omit<Partial<LogMeta>, "logId" | "level" | "timestamp"> & {
|
|
68
|
-
mode?: Mode;
|
|
69
|
-
command?: string;
|
|
70
|
-
logLevel?: LogLevelUserConfig | LogLevelResolvedConfig;
|
|
71
|
-
colors?: WorkspaceConfig["colors"];
|
|
72
|
-
};
|
|
73
|
-
type LogFnMeta = LogLevel | PartialKeys<LogMeta, "logId" | "category" | "timestamp">;
|
|
74
|
-
type LogFn = (meta: LogFnMeta, ...args: string[]) => void;
|
|
75
|
-
type CreateLoggerFunction<TContext extends BaseContext = BaseContext> = (context: TContext) => Logger;
|
|
76
|
-
type LogLevelUserConfig = LogLevel | RequiredKeys<Record<LogCategory, LogLevel | boolean | undefined>, "general">;
|
|
77
|
-
type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;
|
|
78
|
-
declare type __ΩLogLevel = any[];
|
|
79
|
-
declare type __ΩLogCategory = any[];
|
|
80
|
-
declare type __ΩLogMeta = any[];
|
|
81
|
-
declare type __ΩLogger = any[];
|
|
82
|
-
declare type __ΩLogFnConfig = any[];
|
|
83
|
-
declare type __ΩLogFnMeta = any[];
|
|
84
|
-
declare type __ΩLogFn = any[];
|
|
85
|
-
declare type __ΩCreateLoggerFunction = any[];
|
|
86
|
-
declare type __ΩLogLevelUserConfig = any[];
|
|
87
|
-
declare type __ΩLogLevelResolvedConfig = any[];
|
|
88
|
-
//#endregion
|
|
89
|
-
export { CreateLoggerFunction, LogCategories, LogCategory, LogFn, LogFnConfig, LogFnMeta, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMeta, Logger, __ΩCreateLoggerFunction, __ΩLogCategory, __ΩLogFn, __ΩLogFnConfig, __ΩLogFnMeta, __ΩLogLevel, __ΩLogLevelResolvedConfig, __ΩLogLevelUserConfig, __ΩLogMeta, __ΩLogger };
|
|
90
|
-
//# sourceMappingURL=log.d.mts.map
|
package/dist/types/log.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.mts","names":[],"sources":["../../src/types/log.ts"],"mappings":";;;;;KAsBY,QAAA;AAAA,KAEA,WAAA;AAAA,cAYC,SAAA;EAAA;;;;;;;cASA,aAAA;EAAA;;;;;;;;;;;UAaI,OAAA;;AAbjB;;EAiBE,KAAA;EANQ;;;EAUR,KAAA,EAAO,QAAA;;;;EAIP,QAAA,EAAU,WAAA;;;;EAIV,SAAA;;AAhBF;;EAoBE,WAAA;EARqB;;;EAYrB,cAAA;EAZA;;;EAgBA,WAAA;EAJA;;;EAQA,MAAA;EAIM;;AAGR;EAHE,MAAA;AAAA;AAAA,KAGU,MAAA,IAAU,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,KAE5B,WAAA,GAAc,IAAA,CACxB,OAAA,CAAQ,OAAA;EAGR,IAAA,GAAO,IAAA;EACP,OAAA;EACA,QAAA,GAAW,kBAAA,GAAqB,sBAAA;EAChC,MAAA,GAAS,eAAA;AAAA;AAAA,KAGC,SAAA,GACR,QAAA,GACA,WAAA,CAAY,OAAA;AAAA,KAEJ,KAAA,IAAS,IAAA,EAAM,SAAA,KAAc,IAAA;AAAA,KAE7B,oBAAA,kBAAsC,WAAA,GAAc,WAAA,KAC9D,OAAA,EAAS,QAAA,KACN,MAAA;AAAA,KAEO,kBAAA,GACR,QAAA,GACA,YAAA,CACE,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA,KAId,sBAAA,GAAyB,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA"}
|
package/dist/types/log.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/types/log.ts
|
|
2
|
-
const LogLevels = {
|
|
3
|
-
SILENT: "silent",
|
|
4
|
-
ERROR: "error",
|
|
5
|
-
WARN: "warn",
|
|
6
|
-
INFO: "info",
|
|
7
|
-
DEBUG: "debug",
|
|
8
|
-
TRACE: "trace"
|
|
9
|
-
};
|
|
10
|
-
const LogCategories = {
|
|
11
|
-
GENERAL: "general",
|
|
12
|
-
FS: "fs",
|
|
13
|
-
PERFORMANCE: "performance",
|
|
14
|
-
CONFIG: "config",
|
|
15
|
-
PLUGINS: "plugins",
|
|
16
|
-
HOOKS: "hooks",
|
|
17
|
-
ENV: "env",
|
|
18
|
-
IPC: "ipc",
|
|
19
|
-
BABEL: "babel",
|
|
20
|
-
NETWORK: "network"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { LogCategories, LogLevels };
|
|
25
|
-
//# sourceMappingURL=log.mjs.map
|
package/dist/types/log.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.mjs","names":[],"sources":["../../src/types/log.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { PartialKeys, RequiredKeys } from \"@stryke/types/base\";\nimport { Mode, WorkspaceConfig } from \"./config\";\nimport { BaseContext } from \"./context\";\n\nexport type LogLevel = \"silent\" | \"error\" | \"warn\" | \"info\" | \"debug\" | \"trace\";\n\nexport type LogCategory =\n | \"general\"\n | \"fs\"\n | \"performance\"\n | \"config\"\n | \"plugins\"\n | \"hooks\"\n | \"env\"\n | \"ipc\"\n | \"babel\"\n | \"network\";\n\nexport const LogLevels = {\n SILENT: \"silent\",\n ERROR: \"error\",\n WARN: \"warn\",\n INFO: \"info\",\n DEBUG: \"debug\",\n TRACE: \"trace\"\n} as const;\n\nexport const LogCategories = {\n GENERAL: \"general\",\n FS: \"fs\",\n PERFORMANCE: \"performance\",\n CONFIG: \"config\",\n PLUGINS: \"plugins\",\n HOOKS: \"hooks\",\n ENV: \"env\",\n IPC: \"ipc\",\n BABEL: \"babel\",\n NETWORK: \"network\"\n} as const;\n\nexport interface LogMeta {\n /**\n * A unique identifier for the log message, which can be used to correlate related log entries across different parts of the system or different executions.\n */\n logId: string;\n /**\n * The log level label indicating the severity of the log message.\n */\n level: LogLevel;\n /**\n * The category of the log message, which can be used to classify and filter log entries based on their purpose or origin.\n */\n category: LogCategory;\n /**\n * The timestamp when the IPC message was created, represented as the number of milliseconds since the Unix epoch.\n */\n timestamp: number;\n /**\n * A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n executionId?: string;\n /**\n * The zero-based index of the current execution within the sequence of executions in the same process.\n */\n executionIndex?: number;\n /**\n * Optional environment identifier to specify the context or environment in which the message is being processed.\n */\n environment?: string;\n /**\n * Optional plugin name to specify the source plugin of the log message.\n */\n plugin?: string;\n /**\n * The name of the logger or source of the log message, which can be used to identify the origin of the log entry.\n */\n source?: string;\n}\n\nexport type Logger = (meta: LogMeta, ...args: string[]) => void;\n\nexport type LogFnConfig = Omit<\n Partial<LogMeta>,\n \"logId\" | \"level\" | \"timestamp\"\n> & {\n mode?: Mode;\n command?: string;\n logLevel?: LogLevelUserConfig | LogLevelResolvedConfig;\n colors?: WorkspaceConfig[\"colors\"];\n};\n\nexport type LogFnMeta =\n | LogLevel\n | PartialKeys<LogMeta, \"logId\" | \"category\" | \"timestamp\">;\n\nexport type LogFn = (meta: LogFnMeta, ...args: string[]) => void;\n\nexport type CreateLoggerFunction<TContext extends BaseContext = BaseContext> = (\n context: TContext\n) => Logger;\n\nexport type LogLevelUserConfig =\n | LogLevel\n | RequiredKeys<\n Record<LogCategory, LogLevel | boolean | undefined>,\n \"general\"\n >;\n\nexport type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;\n"],"mappings":";AAoCA,MAAa,YAAY;CACvB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,MAAa,gBAAgB;CAC3B,SAAS;CACT,IAAI;CACJ,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,KAAK;CACL,KAAK;CACL,OAAO;CACP,SAAS;CACV"}
|