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