TODO: Test ohne experimental, sobald Compiler-Unterstützung vorhanden ist.
#include <iostream> #include <string> #include <experimental/source_location> void log(std::string message, const std::experimental::source_location& location = std::experimental::source_location::current()) { std::cout << "info:" << location.function_name() << ":" << location.file_name() << ":" << location.line() << ":" << location.column() << " " << message << '\n'; } int main() { log("Hello world!"); }