Skip to content

Make filename, line number and compiler version available during compilation #2297

Description

@kika

What I would love to have is an equivalent to C predefined macros:

  • __LINE__ - expands to the line number of the source file where it's encountered
  • __FILE__ - expands to the source file name
  • __VERSION__ - expands to the version of the compiler used to compile the source

I do most of my debugging with logs and while it's easy to find the position in the source file with the unique log message, sometimes I write "logging function" which dumps a data structure, or state or something like that. And I would like to have a simple way to correlate the log output for such function with the position it was called from.

@paf31 suggested to exploit failed pattern match messages, but while it's good for logging errors in case of catastrophic failure, I believe it's too expensive for casual high volume debug logging.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions