-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
getLogger
to GasketActions (#977)
* fix: types * Update lock file * Added missing deps. * Update docusaurus preset * Use main lock file * Regen lock file * Use @docusaurus/preset-classic 3.5.2 * update lock * lock file --------- Co-authored-by: Kawika Bader <[email protected]>
- Loading branch information
1 parent
dafbb69
commit 30dc358
Showing
13 changed files
with
1,383 additions
and
987 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* eslint-disable no-console */ | ||
/** | ||
* Create a child logger with additional metadata. | ||
* @type {import('.').createChildLogger} | ||
*/ | ||
function createChildLogger(parent, metadata) { | ||
return { | ||
...parent, | ||
debug: (...args) => console.debug(...args, metadata), | ||
error: (...args) => console.error(...args, metadata), | ||
info: (...args) => console.info(...args, metadata), | ||
warn: (...args) => console.warn(...args, metadata), | ||
child: (meta) => createChildLogger(this, { ...metadata, ...meta }) | ||
}; | ||
} | ||
|
||
/** | ||
* Verify that the logger has all required levels. | ||
* @type {import('.').verifyLoggerLevels} | ||
*/ | ||
function verifyLoggerLevels(logger) { | ||
/** @type {Array<keyof import('.').Logger>} */ | ||
const requiredLevels = ['debug', 'error', 'info', 'warn', 'child']; | ||
|
||
requiredLevels.forEach((level) => { | ||
if (typeof logger[level] !== 'function') { | ||
throw new Error(`Logger is missing required level: ${level}`); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = { | ||
createChildLogger, | ||
verifyLoggerLevels | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true, | ||
"noEmit": true, | ||
"skipLibCheck": true, | ||
"noImplicitAny": true, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"lib": [ | ||
"esnext", | ||
"dom" | ||
], | ||
"types": [ | ||
"@types/jest" | ||
] | ||
}, | ||
"include": [ | ||
"lib" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters