@putkoff/abstract-logger 0.0.40 → 0.0.41

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/cjs/index.js CHANGED
@@ -14861,19 +14861,13 @@ function shouldLog(opts, caller) {
14861
14861
  return true;
14862
14862
  }
14863
14863
 
14864
- /* ------------------------------------------------------------------ */
14865
- /* IMPLEMENTATION */
14866
- /* ------------------------------------------------------------------ */
14867
14864
  function getLogString(messageOrOptions, logType = null, details = null, function_name = null, file_location = null, consumerLogger = null) {
14868
- // ---------------- Normalize inputs ----------------
14869
- let opts;
14870
- if (typeof messageOrOptions === "object" && messageOrOptions !== null) {
14871
- // Dict-style
14872
- opts = messageOrOptions;
14873
- }
14874
- else {
14875
- // Positional-style
14876
- opts = {
14865
+ /* -------------------------------------------------- */
14866
+ /* Normalize inputs */
14867
+ /* -------------------------------------------------- */
14868
+ const opts = typeof messageOrOptions === "object" && messageOrOptions !== null
14869
+ ? messageOrOptions
14870
+ : {
14877
14871
  message: messageOrOptions,
14878
14872
  logType,
14879
14873
  details,
@@ -14881,27 +14875,31 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14881
14875
  file_location,
14882
14876
  consumerLogger,
14883
14877
  };
14884
- }
14885
14878
  let { message, logType: resolvedLogType, details: resolvedDetails, function_name: resolvedFunctionName, file_location: resolvedFileLocation, consumerLogger: resolvedLoggerInput, } = opts;
14886
- // ---------------- Resolve caller info ----------------
14879
+ /* -------------------------------------------------- */
14880
+ /* Caller + blocking */
14881
+ /* -------------------------------------------------- */
14887
14882
  const caller = getCallerInfo(getLogString);
14888
14883
  if (!shouldLog(opts, caller)) {
14889
- return ""; // 🔕 blocked — nothing emitted
14884
+ return "";
14890
14885
  }
14891
- // ---------------- Resolve caller info ----------------
14886
+ /* -------------------------------------------------- */
14887
+ /* Final resolved values (single source of truth) */
14888
+ /* -------------------------------------------------- */
14889
+ const finalLogType = resolvedLogType ?? "info";
14892
14890
  resolvedFunctionName = resolveValue(resolvedFunctionName, caller.functionName);
14893
14891
  resolvedFileLocation = resolveValue(resolvedFileLocation, caller.file);
14894
- const finalLogType = resolvedLogType ?? "info";
14895
- const emoji = activityEmojiMap[resolvedLogType ?? ""] ??
14896
- "â„šī¸";
14892
+ /* -------------------------------------------------- */
14893
+ /* Formatting decisions */
14894
+ /* -------------------------------------------------- */
14897
14895
  const LOG_CONFIG = getLogConfig();
14898
14896
  const condense = shouldCondense(finalLogType);
14899
14897
  const showDetails = shouldShowDetails(finalLogType);
14900
- // 👇 ADD THIS
14901
14898
  const pretty = LOG_CONFIG.prettyDetails &&
14902
14899
  !condense;
14900
+ const emoji = activityEmojiMap[finalLogType] ?? "â„šī¸";
14903
14901
  const timestamp = new Date().toISOString();
14904
- if (condense) {
14902
+ if (condense && resolvedFileLocation) {
14905
14903
  resolvedFileLocation = resolvedFileLocation.split("/").pop();
14906
14904
  }
14907
14905
  padRight(emoji, 3);