feat(binding/c): Add support for logging and other layers.
I am trying to integrate C binding into our project and encountered some errors. The error message only contains an error code, so I cannot determine the specific cause of the error. After using some hacky methods, I found the reason for the error, but it is not very user-friendly for developers.
There are many layers in opendal core, including logging, but C binding cannot use these layers yet. I hope to add support for them.
In addition, there are no dependencies on log and env-logging in c binding's cargo. After adding these dependencies, logging can be printed correctly. I hope that c binding can add a method like "opendal_init_logger" to allow users to adjust the logging settings.
I perfer to integrate tools that existing in c or cpp ecosystem, like glog. Using tracing or env-logger in c/cpp projects seems not a good idea.
Just out of curiosity, @jiaoew1991, would you prefer a C++ binding instead of C?
Just out of curiosity, @jiaoew1991, would you prefer a C++ binding instead of C?
If there is a C++ version, it would be better, but if not, it won't affect the usage much. 😄
I perfer to integrate tools that existing in c or cpp ecosystem, like glog. Using
tracingorenv-loggerin c/cpp projects seems not a good idea.
If use an external tool like glog, how can I make the logs inside opendal core be printed out? 🤔
If use an external tool like glog, how can I make the logs inside opendal core be printed out?
There are something the we need to do in bindings:
- Use
glogto implementtracing-subscribeso they can collect log print by opendal core - Implement C binding's own
GlogLayerto allow users to switch betweeen different logging tools.
In this way, our users of c/cpp binding can integrate their native logging tools.
If use an external tool like glog, how can I make the logs inside opendal core be printed out?
There are something the we need to do in bindings:
- Use
glogto implementtracing-subscribeso they can collect log print by opendal core- Implement C binding's own
GlogLayerto allow users to switch betweeen different logging tools.In this way, our users of c/cpp binding can integrate their native logging tools.
We use glog in our project, which is great as it reduces dependencies.