Updated Runtime Logging (markdown)

kunitoki 2012-04-09 14:04:51 -07:00
parent f48d641fad
commit 50a220cab4

@ -5,16 +5,18 @@ TODO
## Logging where it counts when developing in C++
When you develop Mapnik, and need to output log strings that needs to print common info, debug or warning and error strings, then you need to use the newer logger interface. Be sure you have set this option in _config.py_ (or you are building in DEBUG):
```python
ENABLE_LOG = True
```
Then if we have a file called cairo_renderer.cpp and need to debug a string:
```cpp
#include <mapnik/debug.hpp>
...
// here we need to output a string that will be output in DEBUG severity level:
MAPNIK_LOG_DEBUG(cairo_renderer) << "Here i log my data that will be visible when in debug severity level";
MAPNIK_LOG_DEBUG(cairo_renderer) << "Log my data, visible at DEBUG severity level";
```
## Best practices
@ -28,7 +30,6 @@ But if you need to perform complex code before outputting a string to debug, the
// here we need to output a string that will be output in DEBUG severity level:
const double a = 1.0 / sin(x);
const double z = a * connection->get_zoom_from_sql_call();
MAPNIK_LOG_INFO(cairo_renderer) << "Here i log the variable " << z << ", visible when in info severity level";
MAPNIK_LOG_INFO(cairo_renderer) << "Log the variable " << z << ", visible at INFO severity level";
#endif
```