@powerlines/core 0.44.8 → 0.44.9

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.
@@ -131,7 +131,7 @@ const colorBackground = (text) => {
131
131
  const title = (0, _stryke_string_format_title_case.titleCase)(text);
132
132
  return chalk.default.inverse.hex(getTextColor(title))(` ${title} `);
133
133
  };
134
- const consoleLog = (meta, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)(meta.category === require_logging.LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "trace" })(`${meta.name ? chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) : ""}${meta.name ? chalk.default.grey(" > ") : ""}${meta.command && (0, _stryke_string_format_kebab_case.kebabCase)(meta.command) ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.command))}${chalk.default.grey(" > ")}` : ""}${meta.environment && (0, _stryke_string_format_kebab_case.kebabCase)(meta.environment) !== "default" ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.environment))}${chalk.default.grey(" > ")}` : ""}${meta.plugin ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.plugin))}${chalk.default.grey(" > ")}` : ""}${meta.source ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.source))}${chalk.default.grey(" > ")}` : ""}${meta.category && meta.category !== require_logging.LogCategories.GENERAL && meta.category !== require_logging.LogCategories.PERFORMANCE ? `${colorBackground((0, _stryke_string_format_kebab_case.kebabCase)(meta.category))} ` : ""}${args.join(" ")} `.trim());
134
+ const consoleLog = (meta, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)(meta.category === require_logging.LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "all" })(`${meta.name ? chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) : ""}${meta.name ? chalk.default.grey(" > ") : ""}${meta.command && (0, _stryke_string_format_kebab_case.kebabCase)(meta.command) ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.command))}${chalk.default.grey(" > ")}` : ""}${meta.environment && (0, _stryke_string_format_kebab_case.kebabCase)(meta.environment) !== "default" ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.environment))}${chalk.default.grey(" > ")}` : ""}${meta.plugin ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.plugin))}${chalk.default.grey(" > ")}` : ""}${meta.source ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.source))}${chalk.default.grey(" > ")}` : ""}${meta.category && meta.category !== require_logging.LogCategories.GENERAL && meta.category !== require_logging.LogCategories.PERFORMANCE ? `${colorBackground((0, _stryke_string_format_kebab_case.kebabCase)(meta.category))} ` : ""}${args.join(" ")} `.trim());
135
135
  function isValidLogLevel(logLevel, type) {
136
136
  if (logLevel === require_logging.LogLevels.SILENT) return false;
137
137
  return require_logging.LOG_LEVELS.indexOf(logLevel) >= require_logging.LOG_LEVELS.indexOf(type);
@@ -164,7 +164,7 @@ const createLogFn = (name, options) => {
164
164
  type: meta,
165
165
  name
166
166
  };
167
- if (isValidLogLevelConfig(logMeta.type, logLevel, logMeta.category ? logMeta.category : require_logging.LogCategories.GENERAL)) consoleLog(logMeta, ...args);
167
+ if (logMeta.$$ipc || isValidLogLevelConfig(logMeta.type, logLevel, logMeta.category ? logMeta.category : require_logging.LogCategories.GENERAL)) consoleLog(logMeta, ...args);
168
168
  };
169
169
  };
170
170
  const validateLogger = (type, name, options, callback) => {
@@ -197,7 +197,7 @@ const validateLogger = (type, name, options, callback) => {
197
197
  ...message.meta
198
198
  }
199
199
  };
200
- if (isValidLogLevelConfig(type, logLevel, params.meta.category)) callback(params);
200
+ if (params.meta.$$ipc || isValidLogLevelConfig(type, logLevel, params.meta.category)) callback(params);
201
201
  };
202
202
  };
203
203
  const validateCustomLogger = (type, name, options, callback, customCallback) => {
@@ -230,7 +230,7 @@ const validateCustomLogger = (type, name, options, callback, customCallback) =>
230
230
  ...message.meta
231
231
  }
232
232
  };
233
- if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {
233
+ if (params.meta.$$ipc || isValidLogLevelConfig(type, logLevel, params.meta.category)) {
234
234
  callback?.(params);
235
235
  customCallback?.(params);
236
236
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.cts","names":[],"sources":["../../src/plugin-utils/logging.ts"],"mappings":";;;;;;AA2DA;;;;;iBAAgB,SAAA,CAAU,QAAA;;;;;AAiC1B;;iBAzBgB,SAAA,CAAU,OAAA,EAAS,iBAAA;;;;;;;;iBAyBnB,eAAA,CACd,QAAA,GAAW,kBAAA,EACX,IAAA,GAAO,IAAA,GACN,sBAAA;;;;;AA2FH;;cAAa,YAAA,GAAgB,IAAA;;;AAiB7B;;;;cAAa,SAAA,GAAa,IAAA;AAY1B;;;;;AAMA;AANA,cAAa,eAAA,GAAmB,IAAA;AAAA,cAMnB,UAAA,GAAc,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,iBA0C7B,eAAA,CAAgB,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,QAAA;AAAA,iBAQ1C,qBAAA,CACd,IAAA,EAAM,QAAA,EACN,QAAA,EAAU,sBAAA,EACV,QAAA,GAAU,WAAA;;;;;AAXZ;;;cAuBa,WAAA,GAAe,IAAA,UAAc,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AAflE;cAoJa,UAAA,GAAc,MAAA,EAAQ,MAAA,EAAQ,eAAA,EAAiB,MAAA,KAAS,MAAA;;;;;;;;cAuFxD,gBAAA,GACX,MAAA,EAAQ,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AA,EAAM,QAAA,EACN,OAAA,WAAkB,aAAA;;;;;;AA5SpB;;cAuUa,YAAA,GACX,IAAA,UACA,OAAA,EAAS,aAAA,EACT,QAAA,IACE,IAAA,EAAM,QAAA,EACN,OAAA,WAAkB,aAAA,cAEnB,MAAA;;;;;;;;cAuDU,WAAA,GAAe,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;;cAsBrD,YAAA,GACX,MAAA,EAAQ,MAAA,EACR,OAAA,EAAS,aAAA,KACR,MAAA"}
@@ -128,7 +128,7 @@ const colorBackground = (text) => {
128
128
  const title = titleCase(text);
129
129
  return chalk.inverse.hex(getTextColor(title))(` ${title} `);
130
130
  };
131
- const consoleLog = (meta, ...args) => getLogFn(getLogLevel(meta.category === LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "trace" })(`${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : ""}${meta.name ? chalk.grey(" > ") : ""}${meta.command && kebabCase(meta.command) ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.command))}${chalk.grey(" > ")}` : ""}${meta.environment && kebabCase(meta.environment) !== "default" ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.environment))}${chalk.grey(" > ")}` : ""}${meta.plugin ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.plugin))}${chalk.grey(" > ")}` : ""}${meta.source ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.source))}${chalk.grey(" > ")}` : ""}${meta.category && meta.category !== LogCategories.GENERAL && meta.category !== LogCategories.PERFORMANCE ? `${colorBackground(kebabCase(meta.category))} ` : ""}${args.join(" ")} `.trim());
131
+ const consoleLog = (meta, ...args) => getLogFn(getLogLevel(meta.category === LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "all" })(`${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : ""}${meta.name ? chalk.grey(" > ") : ""}${meta.command && kebabCase(meta.command) ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.command))}${chalk.grey(" > ")}` : ""}${meta.environment && kebabCase(meta.environment) !== "default" ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.environment))}${chalk.grey(" > ")}` : ""}${meta.plugin ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.plugin))}${chalk.grey(" > ")}` : ""}${meta.source ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.source))}${chalk.grey(" > ")}` : ""}${meta.category && meta.category !== LogCategories.GENERAL && meta.category !== LogCategories.PERFORMANCE ? `${colorBackground(kebabCase(meta.category))} ` : ""}${args.join(" ")} `.trim());
132
132
  function isValidLogLevel(logLevel, type) {
133
133
  if (logLevel === LogLevels.SILENT) return false;
134
134
  return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);
@@ -161,7 +161,7 @@ const createLogFn = (name, options) => {
161
161
  type: meta,
162
162
  name
163
163
  };
164
- if (isValidLogLevelConfig(logMeta.type, logLevel, logMeta.category ? logMeta.category : LogCategories.GENERAL)) consoleLog(logMeta, ...args);
164
+ if (logMeta.$$ipc || isValidLogLevelConfig(logMeta.type, logLevel, logMeta.category ? logMeta.category : LogCategories.GENERAL)) consoleLog(logMeta, ...args);
165
165
  };
166
166
  };
167
167
  const validateLogger = (type, name, options, callback) => {
@@ -194,7 +194,7 @@ const validateLogger = (type, name, options, callback) => {
194
194
  ...message.meta
195
195
  }
196
196
  };
197
- if (isValidLogLevelConfig(type, logLevel, params.meta.category)) callback(params);
197
+ if (params.meta.$$ipc || isValidLogLevelConfig(type, logLevel, params.meta.category)) callback(params);
198
198
  };
199
199
  };
200
200
  const validateCustomLogger = (type, name, options, callback, customCallback) => {
@@ -227,7 +227,7 @@ const validateCustomLogger = (type, name, options, callback, customCallback) =>
227
227
  ...message.meta
228
228
  }
229
229
  };
230
- if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {
230
+ if (params.meta.$$ipc || isValidLogLevelConfig(type, logLevel, params.meta.category)) {
231
231
  callback?.(params);
232
232
  customCallback?.(params);
233
233
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logging.mjs","names":["defu"],"sources":["../../src/plugin-utils/logging.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 { 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 { isString } from \"@stryke/type-checks/is-string\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode } from \"../types/config\";\nimport { UnresolvedContext } from \"../types/context\";\nimport type {\n CustomLogger,\n CustomLoggerMessage,\n LogCategory,\n LogFn,\n LogFnMeta,\n LogFnOptions,\n LoggerMessage,\n LoggerOptions,\n LogLevel,\n LogLevelResolvedConfig,\n LogLevelUserConfig,\n LogMeta\n} from \"../types/logging\";\nimport { LOG_LEVELS, LogCategories, Logger, LogLevels } from \"../types/logging\";\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevel - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(logLevel: string): boolean;\n\n/**\n * Determines if the provided context is considered verbose (debug or trace).\n *\n * @param context - The context to check, which contains the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(context: UnresolvedContext): boolean;\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevelOrContext - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(\n logLevelOrContext: string | UnresolvedContext\n): boolean {\n const level = isString(logLevelOrContext)\n ? logLevelOrContext\n : logLevelOrContext.config.logLevel;\n\n return level === \"debug\" || level === \"trace\";\n}\n\n/**\n * Resolves the log level configuration based on the provided log level and mode, returning a complete LogLevelResolvedConfig object that specifies the log level for each log category.\n *\n * @param logLevel - The user-provided log level configuration, which can be a string or an object specifying log levels for each category.\n * @param mode - The current mode of the application (e.g., \"development\", \"test\", \"production\"), which determines the default log levels.\n * @returns A LogLevelResolvedConfig object specifying the log level for each log category.\n */\nexport function resolveLogLevel(\n logLevel?: LogLevelUserConfig,\n mode?: Mode\n): LogLevelResolvedConfig {\n if (logLevel === \"trace\") {\n return {\n general: \"trace\",\n fs: \"trace\",\n performance: \"trace\",\n network: \"trace\",\n plugins: \"trace\",\n hooks: \"trace\",\n env: \"trace\",\n ipc: \"trace\",\n config: \"trace\",\n babel: \"trace\"\n };\n } else if (logLevel === \"silent\") {\n return {\n general: \"silent\",\n fs: \"silent\",\n performance: \"silent\",\n network: \"silent\",\n plugins: \"silent\",\n hooks: \"silent\",\n env: \"silent\",\n ipc: \"silent\",\n config: \"silent\",\n babel: \"silent\"\n };\n }\n\n let defaultLogLevel: LogLevelResolvedConfig;\n if (mode === \"development\") {\n defaultLogLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mode === \"test\") {\n defaultLogLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n defaultLogLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n\n if (isSetString(logLevel)) {\n return {\n general: logLevel,\n fs: defaultLogLevel.fs,\n performance: logLevel,\n network: defaultLogLevel.network,\n plugins: logLevel,\n hooks: logLevel,\n env: defaultLogLevel.env,\n ipc: defaultLogLevel.ipc,\n config: defaultLogLevel.config,\n babel: logLevel\n };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\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\nconst BRAND_COLOR = getColor(\"brand\");\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\nexport const consoleLog = (meta: LogMeta, ...args: string[]) =>\n getLogFn(\n getLogLevel(\n meta.category === LogCategories.PERFORMANCE ? \"performance\" : meta.type\n ),\n {\n logLevel: \"trace\"\n }\n )(\n `${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : \"\"}${meta.name ? chalk.grey(\" > \") : \"\"}${\n meta.command && kebabCase(meta.command)\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.command)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.environment && kebabCase(meta.environment) !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.plugin\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.source\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.source)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.category &&\n meta.category !== LogCategories.GENERAL &&\n meta.category !== LogCategories.PERFORMANCE\n ? `${colorBackground(kebabCase(meta.category))} `\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n\nexport function isValidLogLevel(logLevel: LogLevel, type: LogLevel): boolean {\n if (logLevel === LogLevels.SILENT) {\n return false;\n }\n\n return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);\n}\n\nexport function isValidLogLevelConfig(\n type: LogLevel,\n logLevel: LogLevelResolvedConfig,\n category: LogCategory = LogCategories.GENERAL\n): boolean {\n return isValidLogLevel(logLevel[category], type);\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - 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 = (name: string, options: LogFnOptions): LogFn => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (meta: LogFnMeta | LogLevel, ...args: string[]) => {\n const logMeta = isSetObject(meta)\n ? {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n ...meta,\n name\n }\n : {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n type: meta,\n name\n };\n\n if (\n isValidLogLevelConfig(\n logMeta.type,\n logLevel,\n logMeta.category ? logMeta.category : LogCategories.GENERAL\n )\n ) {\n consoleLog(logMeta, ...args);\n }\n };\n};\n\nconst validateLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback: (message: string | LoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {\n callback(params);\n }\n };\n};\n\nconst validateCustomLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback?: (message: string | LoggerMessage) => void,\n customCallback?: (message: CustomLoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {\n callback?.(params);\n customCallback?.(params);\n }\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param secondaryLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogger = (logger: Logger, secondaryLogger: Logger): Logger => {\n const options = { ...secondaryLogger.options, ...logger.options };\n\n const result = {\n options,\n error: validateLogger(\n \"error\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.error?.(message);\n secondaryLogger.error?.(message);\n }\n ),\n warn: validateLogger(\n \"warn\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.warn?.(message);\n secondaryLogger.warn?.(message);\n }\n ),\n info: validateLogger(\n \"info\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.info?.(message);\n secondaryLogger.info?.(message);\n }\n ),\n debug: validateLogger(\n \"debug\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.debug?.(message);\n secondaryLogger.debug?.(message);\n }\n ),\n trace: validateLogger(\n \"trace\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.trace?.(message);\n secondaryLogger.trace?.(message);\n }\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withCustomLogger = (\n logger: Logger,\n customLogger: CustomLogger\n): Logger => {\n const result = {\n options: logger.options,\n error: validateCustomLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n logger.error.bind(logger),\n customLogger.error?.bind(customLogger)\n ),\n warn: validateCustomLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n logger.warn.bind(logger),\n customLogger.warn?.bind(customLogger)\n ),\n info: validateCustomLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n logger.info.bind(logger),\n customLogger.info?.bind(customLogger)\n ),\n debug: validateCustomLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n logger.debug.bind(logger),\n customLogger.debug?.bind(customLogger)\n ),\n trace: validateCustomLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n logger.trace.bind(logger),\n customLogger.trace?.bind(customLogger)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\nexport const consoleLogger = (\n type: LogLevel,\n message: string | LoggerMessage\n) =>\n consoleLog(\n isSetString(message)\n ? {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now()\n }\n : {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...message.meta\n },\n isSetString(message) ? message : message.message\n );\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - 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 createLogger = (\n name: string,\n options: LoggerOptions,\n callback: (\n type: LogLevel,\n message: string | LoggerMessage\n ) => void = consoleLogger\n): Logger => {\n const result = {\n options: { ...options, name },\n error: validateLogger(\"error\", name, { ...options, name }, message =>\n callback(\"error\", message)\n ),\n warn: validateLogger(\"warn\", name, { ...options, name }, message =>\n callback(\"warn\", message)\n ),\n info: validateLogger(\"info\", name, { ...options, name }, message =>\n callback(\"info\", message)\n ),\n debug: validateLogger(\"debug\", name, { ...options, name }, message =>\n callback(\"debug\", message)\n ),\n trace: validateLogger(\"trace\", name, { ...options, name }, message =>\n callback(\"trace\", message)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\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 options - 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, options: LogFnOptions): LogFn => {\n return (meta, ...args) =>\n options.source || options.category\n ? logFn(\n isSetObject(meta)\n ? { ...options, ...meta }\n : { ...options, type: meta },\n `${colorBackground(String(options.source || options.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n\n/**\n * Extend a logger with a specific name and options, adding a colored badge to the log output for each log message generated by the logger.\n *\n * @param logger - The original logger to extend.\n * @param options - 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 extended logger.\n * @returns A new logger that includes the badge in its output for each log message.\n */\nexport const extendLogger = (\n logger: Logger,\n options: LoggerOptions\n): Logger => {\n const opts = { ...logger.options, ...options } as RequiredKeys<\n LoggerOptions,\n \"name\"\n >;\n\n const result = {\n options: opts,\n error: validateLogger(\"error\", opts.name, opts, logger.error.bind(logger)),\n warn: validateLogger(\"warn\", opts.name, opts, logger.warn.bind(logger)),\n info: validateLogger(\"info\", opts.name, opts, logger.info.bind(logger)),\n debug: validateLogger(\"debug\", opts.name, opts, logger.debug.bind(logger)),\n trace: validateLogger(\"trace\", opts.name, opts, logger.trace.bind(logger))\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,UACd,mBACS;CACT,MAAM,QAAQ,SAAS,kBAAkB,GACrC,oBACA,kBAAkB,OAAO;AAE7B,QAAO,UAAU,WAAW,UAAU;;;;;;;;;AAUxC,SAAgB,gBACd,UACA,MACwB;AACxB,KAAI,aAAa,QACf,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;UACQ,aAAa,SACtB,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;CAGH,IAAI;AACJ,KAAI,SAAS,cACX,mBAAkB;UACT,SAAS,OAClB,mBAAkB;KAElB,mBAAkB;AAGpB,KAAI,YAAY,SAAS,CACvB,QAAO;EACL,SAAS;EACT,IAAI,gBAAgB;EACpB,aAAa;EACb,SAAS,gBAAgB;EACzB,SAAS;EACT,OAAO;EACP,KAAK,gBAAgB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ED,QAAO,OAAO,MAAgB,YAAoC;AAChE,UAAQ,MAAR;GACE,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK,SACH;GACF;AACE,WAAO,KAAK,QAAQ;AACpB;;;AAIN,QAAO"}
1
+ {"version":3,"file":"logging.mjs","names":["defu"],"sources":["../../src/plugin-utils/logging.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 { 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 { isString } from \"@stryke/type-checks/is-string\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode } from \"../types/config\";\nimport { UnresolvedContext } from \"../types/context\";\nimport type {\n CustomLogger,\n CustomLoggerMessage,\n LogCategory,\n LogFn,\n LogFnMeta,\n LogFnOptions,\n LoggerMessage,\n LoggerOptions,\n LogLevel,\n LogLevelResolvedConfig,\n LogLevelUserConfig,\n LogMeta\n} from \"../types/logging\";\nimport { LOG_LEVELS, LogCategories, Logger, LogLevels } from \"../types/logging\";\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevel - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(logLevel: string): boolean;\n\n/**\n * Determines if the provided context is considered verbose (debug or trace).\n *\n * @param context - The context to check, which contains the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(context: UnresolvedContext): boolean;\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevelOrContext - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(\n logLevelOrContext: string | UnresolvedContext\n): boolean {\n const level = isString(logLevelOrContext)\n ? logLevelOrContext\n : logLevelOrContext.config.logLevel;\n\n return level === \"debug\" || level === \"trace\";\n}\n\n/**\n * Resolves the log level configuration based on the provided log level and mode, returning a complete LogLevelResolvedConfig object that specifies the log level for each log category.\n *\n * @param logLevel - The user-provided log level configuration, which can be a string or an object specifying log levels for each category.\n * @param mode - The current mode of the application (e.g., \"development\", \"test\", \"production\"), which determines the default log levels.\n * @returns A LogLevelResolvedConfig object specifying the log level for each log category.\n */\nexport function resolveLogLevel(\n logLevel?: LogLevelUserConfig,\n mode?: Mode\n): LogLevelResolvedConfig {\n if (logLevel === \"trace\") {\n return {\n general: \"trace\",\n fs: \"trace\",\n performance: \"trace\",\n network: \"trace\",\n plugins: \"trace\",\n hooks: \"trace\",\n env: \"trace\",\n ipc: \"trace\",\n config: \"trace\",\n babel: \"trace\"\n };\n } else if (logLevel === \"silent\") {\n return {\n general: \"silent\",\n fs: \"silent\",\n performance: \"silent\",\n network: \"silent\",\n plugins: \"silent\",\n hooks: \"silent\",\n env: \"silent\",\n ipc: \"silent\",\n config: \"silent\",\n babel: \"silent\"\n };\n }\n\n let defaultLogLevel: LogLevelResolvedConfig;\n if (mode === \"development\") {\n defaultLogLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mode === \"test\") {\n defaultLogLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n defaultLogLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n\n if (isSetString(logLevel)) {\n return {\n general: logLevel,\n fs: defaultLogLevel.fs,\n performance: logLevel,\n network: defaultLogLevel.network,\n plugins: logLevel,\n hooks: logLevel,\n env: defaultLogLevel.env,\n ipc: defaultLogLevel.ipc,\n config: defaultLogLevel.config,\n babel: logLevel\n };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\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\nconst BRAND_COLOR = getColor(\"brand\");\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\nexport const consoleLog = (meta: LogMeta, ...args: string[]) =>\n getLogFn(\n getLogLevel(\n meta.category === LogCategories.PERFORMANCE ? \"performance\" : meta.type\n ),\n {\n logLevel: \"all\"\n }\n )(\n `${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : \"\"}${meta.name ? chalk.grey(\" > \") : \"\"}${\n meta.command && kebabCase(meta.command)\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.command)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.environment && kebabCase(meta.environment) !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.plugin\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.source\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.source)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.category &&\n meta.category !== LogCategories.GENERAL &&\n meta.category !== LogCategories.PERFORMANCE\n ? `${colorBackground(kebabCase(meta.category))} `\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n\nexport function isValidLogLevel(logLevel: LogLevel, type: LogLevel): boolean {\n if (logLevel === LogLevels.SILENT) {\n return false;\n }\n\n return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);\n}\n\nexport function isValidLogLevelConfig(\n type: LogLevel,\n logLevel: LogLevelResolvedConfig,\n category: LogCategory = LogCategories.GENERAL\n): boolean {\n return isValidLogLevel(logLevel[category], type);\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - 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 = (name: string, options: LogFnOptions): LogFn => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (meta: LogFnMeta | LogLevel, ...args: string[]) => {\n const logMeta = isSetObject(meta)\n ? {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n ...meta,\n name\n }\n : {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n type: meta,\n name\n };\n\n if (\n logMeta.$$ipc ||\n isValidLogLevelConfig(\n logMeta.type,\n logLevel,\n logMeta.category ? logMeta.category : LogCategories.GENERAL\n )\n ) {\n consoleLog(logMeta, ...args);\n }\n };\n};\n\nconst validateLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback: (message: string | LoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (\n params.meta.$$ipc ||\n isValidLogLevelConfig(type, logLevel, params.meta.category)\n ) {\n callback(params);\n }\n };\n};\n\nconst validateCustomLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback?: (message: string | LoggerMessage) => void,\n customCallback?: (message: CustomLoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (\n params.meta.$$ipc ||\n isValidLogLevelConfig(type, logLevel, params.meta.category)\n ) {\n callback?.(params);\n customCallback?.(params);\n }\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param secondaryLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogger = (logger: Logger, secondaryLogger: Logger): Logger => {\n const options = { ...secondaryLogger.options, ...logger.options };\n\n const result = {\n options,\n error: validateLogger(\n \"error\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.error?.(message);\n secondaryLogger.error?.(message);\n }\n ),\n warn: validateLogger(\n \"warn\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.warn?.(message);\n secondaryLogger.warn?.(message);\n }\n ),\n info: validateLogger(\n \"info\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.info?.(message);\n secondaryLogger.info?.(message);\n }\n ),\n debug: validateLogger(\n \"debug\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.debug?.(message);\n secondaryLogger.debug?.(message);\n }\n ),\n trace: validateLogger(\n \"trace\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.trace?.(message);\n secondaryLogger.trace?.(message);\n }\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withCustomLogger = (\n logger: Logger,\n customLogger: CustomLogger\n): Logger => {\n const result = {\n options: logger.options,\n error: validateCustomLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n logger.error.bind(logger),\n customLogger.error?.bind(customLogger)\n ),\n warn: validateCustomLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n logger.warn.bind(logger),\n customLogger.warn?.bind(customLogger)\n ),\n info: validateCustomLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n logger.info.bind(logger),\n customLogger.info?.bind(customLogger)\n ),\n debug: validateCustomLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n logger.debug.bind(logger),\n customLogger.debug?.bind(customLogger)\n ),\n trace: validateCustomLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n logger.trace.bind(logger),\n customLogger.trace?.bind(customLogger)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\nexport const consoleLogger = (\n type: LogLevel,\n message: string | LoggerMessage\n) =>\n consoleLog(\n isSetString(message)\n ? {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now()\n }\n : {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...message.meta\n },\n isSetString(message) ? message : message.message\n );\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - 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 createLogger = (\n name: string,\n options: LoggerOptions,\n callback: (\n type: LogLevel,\n message: string | LoggerMessage\n ) => void = consoleLogger\n): Logger => {\n const result = {\n options: { ...options, name },\n error: validateLogger(\"error\", name, { ...options, name }, message =>\n callback(\"error\", message)\n ),\n warn: validateLogger(\"warn\", name, { ...options, name }, message =>\n callback(\"warn\", message)\n ),\n info: validateLogger(\"info\", name, { ...options, name }, message =>\n callback(\"info\", message)\n ),\n debug: validateLogger(\"debug\", name, { ...options, name }, message =>\n callback(\"debug\", message)\n ),\n trace: validateLogger(\"trace\", name, { ...options, name }, message =>\n callback(\"trace\", message)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\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 options - 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, options: LogFnOptions): LogFn => {\n return (meta, ...args) =>\n options.source || options.category\n ? logFn(\n isSetObject(meta)\n ? { ...options, ...meta }\n : { ...options, type: meta },\n `${colorBackground(String(options.source || options.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n\n/**\n * Extend a logger with a specific name and options, adding a colored badge to the log output for each log message generated by the logger.\n *\n * @param logger - The original logger to extend.\n * @param options - 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 extended logger.\n * @returns A new logger that includes the badge in its output for each log message.\n */\nexport const extendLogger = (\n logger: Logger,\n options: LoggerOptions\n): Logger => {\n const opts = { ...logger.options, ...options } as RequiredKeys<\n LoggerOptions,\n \"name\"\n >;\n\n const result = {\n options: opts,\n error: validateLogger(\"error\", opts.name, opts, logger.error.bind(logger)),\n warn: validateLogger(\"warn\", opts.name, opts, logger.warn.bind(logger)),\n info: validateLogger(\"info\", opts.name, opts, logger.info.bind(logger)),\n debug: validateLogger(\"debug\", opts.name, opts, logger.debug.bind(logger)),\n trace: validateLogger(\"trace\", opts.name, opts, logger.trace.bind(logger))\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,UACd,mBACS;CACT,MAAM,QAAQ,SAAS,kBAAkB,GACrC,oBACA,kBAAkB,OAAO;AAE7B,QAAO,UAAU,WAAW,UAAU;;;;;;;;;AAUxC,SAAgB,gBACd,UACA,MACwB;AACxB,KAAI,aAAa,QACf,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;UACQ,aAAa,SACtB,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS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MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC1E,MAAM,eAAe,QAAQ,KAAK,MAAM,MAAM,OAAO,KAAK,KAAK,OAAO,CAAC;EACvE,MAAM,eAAe,QAAQ,KAAK,MAAM,MAAM,OAAO,KAAK,KAAK,OAAO,CAAC;EACvE,OAAO,eAAe,SAAS,KAAK,MAAM,MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC1E,OAAO,eAAe,SAAS,KAAK,MAAM,MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC3E;AAED,QAAO,OAAO,MAAgB,YAAoC;AAChE,UAAQ,MAAR;GACE,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK,SACH;GACF;AACE,WAAO,KAAK,QAAQ;AACpB;;;AAIN,QAAO"}
@@ -280,7 +280,7 @@ interface EngineOptions {
280
280
  */
281
281
  configFile?: string;
282
282
  }
283
- type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile" | "name">;
283
+ type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile" | "name" | "logLevel">;
284
284
  interface ExecutionOptions extends EngineOptions {
285
285
  /**
286
286
  * 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.
@@ -280,7 +280,7 @@ interface EngineOptions {
280
280
  */
281
281
  configFile?: string;
282
282
  }
283
- type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile" | "name">;
283
+ type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile" | "name" | "logLevel">;
284
284
  interface ExecutionOptions extends EngineOptions {
285
285
  /**
286
286
  * 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.
@@ -76,6 +76,12 @@ interface LogMeta {
76
76
  * The name of the logger or source of the log message, which can be used to identify the origin of the log entry.
77
77
  */
78
78
  source?: string;
79
+ /**
80
+ * Indicates whether the log message is related to inter-process communication (IPC).
81
+ *
82
+ * @internal
83
+ */
84
+ $$ipc?: boolean;
79
85
  }
80
86
  type LogFnOptions = Omit<Partial<LogMeta>, "logId" | "timestamp" | "name" | "type"> & {
81
87
  mode?: Mode;
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.cts","names":[],"sources":["../../src/types/logging.ts"],"mappings":";;;;;cAsBa,SAAA;EAAA;;;;;;;cASA,UAAA;AAAA,KASD,QAAA,WAAmB,UAAA;AAAA,cAElB,aAAA;EAAA;;;;;;;;;;;cAaA,cAAA;AAAA,KAaD,WAAA,WAAsB,cAAA;AAAA,UAEjB,OAAA;EAjBP;;;EAqBR,KAAA;;;;EAIA,IAAA,EAAM,QAAA;;;;EAIN,QAAA,EAAU,WAAA;;;;EAIV,SAAA;EApBQ;;;EAwBR,IAAA;EAtBU;;;EA0BV,WAAA;EA1B8C;AAEhD;;EA4BE,cAAA;EAhBqB;;;EAoBrB,OAAA;EApBA;;;EAwBA,IAAA;EAZA;;;EAgBA,WAAA;EAAA;;;EAIA,MAAA;EAIM;AAGR;;EAHE,MAAA;AAAA;AAAA,KAGU,YAAA,GAAe,IAAA,CACzB,OAAA,CAAQ,OAAA;EAGR,IAAA,GAAO,IAAA;EACP,QAAA,GAAW,kBAAA;AAAA;AAAA,KAGD,SAAA,GACR,QAAA,GACA,WAAA,CAAY,OAAA;AAAA,KAEJ,KAAA,IAAS,IAAA,EAAM,SAAA,KAAc,IAAA;AAAA,KAE7B,UAAA,GAAa,WAAA,CACvB,IAAA,CAAK,OAAA;AAAA,KAIK,aAAA,GAAgB,IAAA,CAAK,UAAA;EAC/B,IAAA,GAAO,IAAA;EACP,QAAA,GAAW,kBAAA;AAAA;AAAA,UAGI,iBAAA,gBAAiC,eAAA;EAChD,IAAA,EAA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,IAAA,IAAQ,OAAA,EAAS,mBAAA;EAjDY;;;;;;EAwD7B,IAAA,IAAQ,OAAA,EAAS,mBAAA;EAxDY;;AAG/B;;;;EA4DE,KAAA,IAAS,OAAA,EAAS,mBAAA;EA5D8B;;;;;AAIlD;EA+DE,KAAA,IAAS,OAAA,EAAS,mBAAA;AAAA;AAAA,KAGR,kBAAA,GACR,QAAA,GACA,YAAA,CACE,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA,KAItB,sBAAA,GAAyB,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA"}
@@ -76,6 +76,12 @@ interface LogMeta {
76
76
  * The name of the logger or source of the log message, which can be used to identify the origin of the log entry.
77
77
  */
78
78
  source?: string;
79
+ /**
80
+ * Indicates whether the log message is related to inter-process communication (IPC).
81
+ *
82
+ * @internal
83
+ */
84
+ $$ipc?: boolean;
79
85
  }
80
86
  type LogFnOptions = Omit<Partial<LogMeta>, "logId" | "timestamp" | "name" | "type"> & {
81
87
  mode?: Mode;
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.mts","names":[],"sources":["../../src/types/logging.ts"],"mappings":";;;;;cAsBa,SAAA;EAAA;;;;;;;cASA,UAAA;AAAA,KASD,QAAA,WAAmB,UAAA;AAAA,cAElB,aAAA;EAAA;;;;;;;;;;;cAaA,cAAA;AAAA,KAaD,WAAA,WAAsB,cAAA;AAAA,UAEjB,OAAA;EAjBP;;;EAqBR,KAAA;;;;EAIA,IAAA,EAAM,QAAA;;;;EAIN,QAAA,EAAU,WAAA;;;;EAIV,SAAA;EApBQ;;;EAwBR,IAAA;EAtBU;;;EA0BV,WAAA;EA1B8C;AAEhD;;EA4BE,cAAA;EAhBqB;;;EAoBrB,OAAA;EApBA;;;EAwBA,IAAA;EAZA;;;EAgBA,WAAA;EAAA;;;EAIA,MAAA;EAIM;AAGR;;EAHE,MAAA;AAAA;AAAA,KAGU,YAAA,GAAe,IAAA,CACzB,OAAA,CAAQ,OAAA;EAGR,I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AA,WAAkB,aAAA;EACzB,IAAA,GAAO,OAAA,WAAkB,aAAA;EACzB,KAAA,GAAQ,OAAA,WAAkB,aAAA;EAC1B,KAAA,GAAQ,OAAA,WAAkB,aAAA;EAC1B,GAAA,GAAM,IAAA,EAAM,QAAA,EAAU,OAAA,WAAkB,aAAA;AAAA;;AA/B1C;;KAqCY,mBAAA,GAAsB,iBAAA,CAAkB,IAAA,CAAK,OAAA;;;;UAKxC,YAAA;EA1CmB;;;;;;EAiDlC,KAAA,IAAS,OAAA,EAAS,mBAAA;EA5CK;;;;;;EAmDvB,IAAA,IAAQ,OAAA,EAAS,mBAAA;EAjDY;;;;;;EAwD7B,IAAA,IAAQ,OAAA,EAAS,mBAAA;EAxDY;;AAG/B;;;;EA4DE,KAAA,IAAS,OAAA,EAAS,mBAAA;EA5D8B;;;;;AAIlD;EA+DE,KAAA,IAAS,OAAA,EAAS,mBAAA;AAAA;AAAA,KAGR,kBAAA,GACR,QAAA,GACA,YAAA,CACE,OAAA,CAAQ,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA,KAItB,sBAAA,GAAyB,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"logging.mjs","names":[],"sources":["../../src/types/logging.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 { UnpluginMessage } from \"unplugin\";\nimport { Mode } from \"./config\";\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 LOG_LEVELS = [\n LogLevels.SILENT,\n LogLevels.ERROR,\n LogLevels.WARN,\n LogLevels.INFO,\n LogLevels.DEBUG,\n LogLevels.TRACE\n] as const;\n\nexport type LogLevel = (typeof LOG_LEVELS)[number];\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 const LOG_CATEGORIES = [\n LogCategories.GENERAL,\n LogCategories.FS,\n LogCategories.PERFORMANCE,\n LogCategories.CONFIG,\n LogCategories.PLUGINS,\n LogCategories.HOOKS,\n LogCategories.ENV,\n LogCategories.IPC,\n LogCategories.NETWORK,\n LogCategories.BABEL\n] as const;\n\nexport type LogCategory = (typeof LOG_CATEGORIES)[number];\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 of the message, which indicates the severity or importance of the log entry. The log level can be used to filter log messages based on their importance, allowing users to focus on critical issues or relevant information while ignoring less important messages.\n */\n type: 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 * The name of the project or package associated with the log message, which can be used to identify the source of the log entry and provide context for the message.\n */\n name?: string;\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 command identifier to specify the command or task associated with the log message, which can be used to provide additional context about the operation being performed when the log entry was generated.\n */\n command?: string;\n /**\n * Optional hook name to specify the plugin hook associated with the log message, which can be used to provide additional context about the specific plugin hook being executed when the log entry was generated.\n */\n hook?: string;\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 LogFnOptions = Omit<\n Partial<LogMeta>,\n \"logId\" | \"timestamp\" | \"name\" | \"type\"\n> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport type LogFnMeta =\n | LogLevel\n | PartialKeys<LogMeta, \"logId\" | \"timestamp\" | \"name\" | \"category\">;\n\nexport type LogFn = (meta: LogFnMeta, ...args: string[]) => void;\n\nexport type LoggerMeta = PartialKeys<\n Omit<LogMeta, \"type\">,\n \"logId\" | \"timestamp\" | \"name\" | \"category\"\n>;\n\nexport type LoggerOptions = Omit<LoggerMeta, \"logId\" | \"timestamp\" | \"type\"> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport interface PowerlinesMessage<TMeta> extends UnpluginMessage {\n meta: TMeta;\n}\n\nexport type LogMessage = PowerlinesMessage<Partial<LogMeta>>;\n\n/**\n * A type representing a log message that can be passed to the logging methods defined in the {@link Logger} interface, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link Logger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in the logging implementation.\n */\nexport type LoggerMessage = PowerlinesMessage<LoggerMeta>;\n\n/**\n * An internal interface representing a logger instance used within Powerlines for logging messages at various log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". This interface defines methods for logging messages at each log level, which accept a message parameter that can be either a string or an object containing the log metadata and message content. The logger instance also includes an options property that contains the configuration options used for the logger, such as the source, command, environment, plugin, log level, and other relevant metadata. This interface is intended for internal use within Powerlines and is not meant to be implemented by users directly; instead, users can provide a custom logger that implements the {@link CustomLogger} interface to integrate with Powerlines' logging system.\n */\nexport interface Logger {\n options: LoggerOptions;\n error: (message: string | LoggerMessage) => void;\n warn: (message: string | LoggerMessage) => void;\n info: (message: string | LoggerMessage) => void;\n debug: (message: string | LoggerMessage) => void;\n trace: (message: string | LoggerMessage) => void;\n log: (type: LogLevel, message: string | LoggerMessage) => void;\n}\n\n/**\n * A type representing a log message that can be passed to a custom logger, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link CustomLogger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in their custom logging implementation.\n */\nexport type CustomLoggerMessage = PowerlinesMessage<Omit<LogMeta, \"type\">>;\n\n/**\n * An interface representing a custom logger that can be provided by the user to override the default logging behavior of Powerlines. This interface defines methods for logging messages at different log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". Each method accepts a message parameter, which can be either a string or an object containing the log metadata and message content. By implementing this interface, users can integrate their own logging system with Powerlines or customize the logging behavior to suit their specific needs.\n */\nexport interface CustomLogger {\n /**\n * A function to log messages at the \"error\" level, which indicates a serious issue that has caused a failure in the build process or a critical problem that needs immediate attention.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the error being reported.\n * @returns void\n */\n error?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"warn\" level, which indicates a potential issue or a situation that may require attention but does not necessarily cause a failure in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the warning being reported.\n * @returns void\n */\n warn?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"info\" level, which indicates general informational messages about the build process, such as the start and completion of tasks, configuration details, or other relevant information that may be useful for monitoring the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the informational message being reported.\n * @returns void\n */\n info?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"debug\" level, which indicates detailed debugging information that may be useful for diagnosing issues during development or troubleshooting problems in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the debug information being reported.\n * @returns void\n */\n debug?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"trace\" level, which indicates very detailed tracing information that may be useful for in-depth analysis of the build process or for tracking the flow of execution through various stages of the build.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the trace information being reported.\n * @returns void\n */\n trace?: (message: CustomLoggerMessage) => void;\n}\n\nexport type LogLevelUserConfig =\n | LogLevel\n | RequiredKeys<\n Partial<Record<LogCategory, LogLevel | boolean | undefined>>,\n \"general\"\n >;\n\nexport type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;\n"],"mappings":";AAsBA,MAAa,YAAY;CACvB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,MAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACX;AAID,MAAa,gBAAgB;CAC3B,SAAS;CACT,IAAI;CACJ,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,KAAK;CACL,KAAK;CACL,OAAO;CACP,SAAS;CACV;AAED,MAAa,iBAAiB;CAC5B,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACf"}
1
+ {"version":3,"file":"logging.mjs","names":[],"sources":["../../src/types/logging.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 { UnpluginMessage } from \"unplugin\";\nimport { Mode } from \"./config\";\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 LOG_LEVELS = [\n LogLevels.SILENT,\n LogLevels.ERROR,\n LogLevels.WARN,\n LogLevels.INFO,\n LogLevels.DEBUG,\n LogLevels.TRACE\n] as const;\n\nexport type LogLevel = (typeof LOG_LEVELS)[number];\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 const LOG_CATEGORIES = [\n LogCategories.GENERAL,\n LogCategories.FS,\n LogCategories.PERFORMANCE,\n LogCategories.CONFIG,\n LogCategories.PLUGINS,\n LogCategories.HOOKS,\n LogCategories.ENV,\n LogCategories.IPC,\n LogCategories.NETWORK,\n LogCategories.BABEL\n] as const;\n\nexport type LogCategory = (typeof LOG_CATEGORIES)[number];\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 of the message, which indicates the severity or importance of the log entry. The log level can be used to filter log messages based on their importance, allowing users to focus on critical issues or relevant information while ignoring less important messages.\n */\n type: 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 * The name of the project or package associated with the log message, which can be used to identify the source of the log entry and provide context for the message.\n */\n name?: string;\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 command identifier to specify the command or task associated with the log message, which can be used to provide additional context about the operation being performed when the log entry was generated.\n */\n command?: string;\n /**\n * Optional hook name to specify the plugin hook associated with the log message, which can be used to provide additional context about the specific plugin hook being executed when the log entry was generated.\n */\n hook?: string;\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 * Indicates whether the log message is related to inter-process communication (IPC).\n *\n * @internal\n */\n $$ipc?: boolean;\n}\n\nexport type LogFnOptions = Omit<\n Partial<LogMeta>,\n \"logId\" | \"timestamp\" | \"name\" | \"type\"\n> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport type LogFnMeta =\n | LogLevel\n | PartialKeys<LogMeta, \"logId\" | \"timestamp\" | \"name\" | \"category\">;\n\nexport type LogFn = (meta: LogFnMeta, ...args: string[]) => void;\n\nexport type LoggerMeta = PartialKeys<\n Omit<LogMeta, \"type\">,\n \"logId\" | \"timestamp\" | \"name\" | \"category\"\n>;\n\nexport type LoggerOptions = Omit<LoggerMeta, \"logId\" | \"timestamp\" | \"type\"> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport interface PowerlinesMessage<TMeta> extends UnpluginMessage {\n meta: TMeta;\n}\n\nexport type LogMessage = PowerlinesMessage<Partial<LogMeta>>;\n\n/**\n * A type representing a log message that can be passed to the logging methods defined in the {@link Logger} interface, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link Logger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in the logging implementation.\n */\nexport type LoggerMessage = PowerlinesMessage<LoggerMeta>;\n\n/**\n * An internal interface representing a logger instance used within Powerlines for logging messages at various log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". This interface defines methods for logging messages at each log level, which accept a message parameter that can be either a string or an object containing the log metadata and message content. The logger instance also includes an options property that contains the configuration options used for the logger, such as the source, command, environment, plugin, log level, and other relevant metadata. This interface is intended for internal use within Powerlines and is not meant to be implemented by users directly; instead, users can provide a custom logger that implements the {@link CustomLogger} interface to integrate with Powerlines' logging system.\n */\nexport interface Logger {\n options: LoggerOptions;\n error: (message: string | LoggerMessage) => void;\n warn: (message: string | LoggerMessage) => void;\n info: (message: string | LoggerMessage) => void;\n debug: (message: string | LoggerMessage) => void;\n trace: (message: string | LoggerMessage) => void;\n log: (type: LogLevel, message: string | LoggerMessage) => void;\n}\n\n/**\n * A type representing a log message that can be passed to a custom logger, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link CustomLogger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in their custom logging implementation.\n */\nexport type CustomLoggerMessage = PowerlinesMessage<Omit<LogMeta, \"type\">>;\n\n/**\n * An interface representing a custom logger that can be provided by the user to override the default logging behavior of Powerlines. This interface defines methods for logging messages at different log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". Each method accepts a message parameter, which can be either a string or an object containing the log metadata and message content. By implementing this interface, users can integrate their own logging system with Powerlines or customize the logging behavior to suit their specific needs.\n */\nexport interface CustomLogger {\n /**\n * A function to log messages at the \"error\" level, which indicates a serious issue that has caused a failure in the build process or a critical problem that needs immediate attention.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the error being reported.\n * @returns void\n */\n error?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"warn\" level, which indicates a potential issue or a situation that may require attention but does not necessarily cause a failure in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the warning being reported.\n * @returns void\n */\n warn?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"info\" level, which indicates general informational messages about the build process, such as the start and completion of tasks, configuration details, or other relevant information that may be useful for monitoring the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the informational message being reported.\n * @returns void\n */\n info?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"debug\" level, which indicates detailed debugging information that may be useful for diagnosing issues during development or troubleshooting problems in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the debug information being reported.\n * @returns void\n */\n debug?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"trace\" level, which indicates very detailed tracing information that may be useful for in-depth analysis of the build process or for tracking the flow of execution through various stages of the build.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the trace information being reported.\n * @returns void\n */\n trace?: (message: CustomLoggerMessage) => void;\n}\n\nexport type LogLevelUserConfig =\n | LogLevel\n | RequiredKeys<\n Partial<Record<LogCategory, LogLevel | boolean | undefined>>,\n \"general\"\n >;\n\nexport type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;\n"],"mappings":";AAsBA,MAAa,YAAY;CACvB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,MAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACX;AAID,MAAa,gBAAgB;CAC3B,SAAS;CACT,IAAI;CACJ,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,KAAK;CACL,KAAK;CACL,OAAO;CACP,SAAS;CACV;AAED,MAAa,iBAAiB;CAC5B,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.44.8",
3
+ "version": "0.44.9",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -237,5 +237,5 @@
237
237
  "typescript": "^6.0.3"
238
238
  },
239
239
  "publishConfig": { "access": "public" },
240
- "gitHead": "189d9bc757a9e32e1c391cd3e216168d536b5b2e"
240
+ "gitHead": "e3dcc0efffdbe504c3aa9d1ecded65f8b6bce0a4"
241
241
  }