@openfn/logger
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -27,2 +27,3 @@ declare type LogLevel = 'debug' | 'info' | 'default' | 'none'; | ||
success(...args: any[]): void; | ||
print(...args: any[]): void; | ||
confirm(message: string, force?: boolean): Promise<boolean>; | ||
@@ -34,3 +35,3 @@ timer(name: string): string | undefined; | ||
declare type LogMessage = [LogFns | 'confirm', ...any[]]; | ||
declare type LogMessage = [LogFns | 'confirm' | 'print', ...any[]]; | ||
declare type MockLogger = Logger & { | ||
@@ -37,0 +38,0 @@ _last: LogMessage; |
@@ -125,2 +125,7 @@ // src/logger.ts | ||
}; | ||
const print = (...args) => { | ||
if (opts.level !== NONE) { | ||
emitter.info(...args); | ||
} | ||
}; | ||
const confirm = async (message, force = false) => { | ||
@@ -151,2 +156,3 @@ if (force) { | ||
timer, | ||
print, | ||
force: () => { | ||
@@ -183,2 +189,7 @@ }, | ||
const mock = m; | ||
mock.print = (...out) => { | ||
if (opts.level !== "none") { | ||
history.push(["print", ...out]); | ||
} | ||
}; | ||
Object.defineProperty(mock, "_last", { | ||
@@ -199,2 +210,5 @@ get: () => history[history.length - 1] || [] | ||
} | ||
if (log[0] === "print") { | ||
return { level: "print", message: log[1], messageRaw: [log[1]] }; | ||
} | ||
if (name && !opts.hideNamespace && !opts.hideIcons) { | ||
@@ -201,0 +215,0 @@ [level, namespace, icon, ...messageParts] = log; |
{ | ||
"name": "@openfn/logger", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Cross-package logging utility", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10911
294