__LINE__ or __FILE__ Equivalent

Is there an equivalent way to get to C’s __LINE__ or __FILE__ macros in zig? Would be useful for logging rather than coming up with a unique string that I grep for.

1 Like

Hello, there is @src().
However note that it must be called inside a function, standalone usecase is not supported.

3 Likes

As @Bobvan said, you have @src().

I learned this through ziglings’s exercise 114, which by looking at the bottom you may find an example.

3 Likes

Thanks! Blah blah word count blah

2 Likes