Created
June 13, 2023 21:18
-
-
Save ededejr/0f7c1d810295341f1bd42055b71194d2 to your computer and use it in GitHub Desktop.
simple debug function which logs its caller
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
const debug = (...messages: unknown[]) => { | |
const { stack } = new Error(""); | |
const caller = stack?.split("\n")?.[2].trim().split(" ")[1]; | |
console.log(`[ededejr|${caller}]: `, ...messages); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment