s3-file-manager
Version:
A streamlined, high-level S3 client for Node.js with built-in retries and support for uploads, downloads, and file operations — works with any S3-compatible storage.
18 lines (17 loc) • 553 B
JavaScript
/**
* Type guard to validate a logger implements the Logger interface.
*/
export const isValidLogger = (obj) => {
if (obj != null &&
typeof obj.info === "function" &&
typeof obj.warn === "function" &&
typeof obj.error === "function") {
return true;
}
else if (obj != null) {
console.error(`Invalid \`logger\` provided (type: ${typeof obj}); ` +
`it must have \`info\`, \`warn\`, and \`error\` methods. ` +
`Using default console logger instead.`);
}
return false;
};