Blame docs/trace.md

Packit Service 7770af
## This is proposed interface in https://github.com/sass/libsass/pull/1288
Packit Service 7770af
Packit Service 7770af
Additional debugging macros with low overhead are available, `TRACE()` and `TRACEINST()`.
Packit Service 7770af
Packit Service 7770af
Both macros simulate a string stream, so they can be used like this:
Packit Service 7770af
Packit Service 7770af
    TRACE() << "Reached.";
Packit Service 7770af
Packit Service 7770af
produces:
Packit Service 7770af
Packit Service 7770af
    [LibSass] parse_value parser.cpp:1384 Reached.
Packit Service 7770af
Packit Service 7770af
`TRACE()`
Packit Service 7770af
   logs function name, source filename, source file name to the standard error and the attached
Packit Service 7770af
   stream to the standard error.
Packit Service 7770af
Packit Service 7770af
`TRACEINST(obj)`
Packit Service 7770af
   logs object instance address, function name, source filename, source file name to the standard error and the attached stream to the standard error, for example:
Packit Service 7770af
Packit Service 7770af
    TRACEINST(this) << "String_Constant created " << this;
Packit Service 7770af
Packit Service 7770af
produces:
Packit Service 7770af
Packit Service 7770af
    [LibSass] 0x8031ba980:String_Constant ./ast.hpp:1371 String_Constant created (0,"auto")
Packit Service 7770af
Packit Service 7770af
The macros generate output only of `LibSass_TRACE` is set in the environment.