cortoproject / corto

A hierarchical object store for connecting realtime machine data with web applications, historians & more
https://www.corto.io
MIT License
87 stars 14 forks source link

Allow logging of nested components #621

Closed SanderMertens closed 6 years ago

SanderMertens commented 7 years ago

When using the corto logging framework, it is possible to specify components by adding a string followed by an :, like this:

corto_info("myComponent: the info message");

This is however of limited usefulness, as code often does not know in which context it is called, and without this context a message loses part of its meaning. To make keeping track of this context easier, a user should be able to "push" and "pop" components, like this:

corto_component_push("myComponent");
corto_info("the info message");
corto_component_pop();

Suppose that this code was called from another part of the code that also pushed a component called "root", then the log message would like like this:

root.myComponent: the info message