Skip to content

Instantly share code, notes, and snippets.

@Yardanico
Created January 11, 2018 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yardanico/cd3fb7a093a177da255335cb9d90c632 to your computer and use it in GitHub Desktop.
Save Yardanico/cd3fb7a093a177da255335cb9d90c632 to your computer and use it in GitHub Desktop.
import strformat
template log(data: string): untyped =
const
pos = instantiationInfo()
addition =
when defined(release):
fmt"[{pos.filename}] "
else:
fmt"[{pos.filename}:{pos.line}] "
echo addition & data
log("hi")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment