4
submitted 1 year ago by kixik@lemmy.ml to c/cpp@lemmy.ml

cross-posted from: https://lemmy.ml/post/4072147

Is there a library for C, providing thread safe (high performance), and structured logging? An example for rust is the Tracing crate for rust (from Tokio). It should support several outputs as well.

top 5 comments
sorted by: hot top controversial new old
[-] Falmarri@lemmy.world 1 points 1 year ago

I've been looking for this for a few years now. Seems the answer is no, if you mean a de facto one. I hacked some structured log into spdlog, but it's far from good enough

[-] kixik@lemmy.ml 1 points 1 year ago

BTW, that's a c++ lib (I was looking for a C one, but one never knows). I'm aware of zlog, for example, but it doesn't offer structured logs. Sad to read it seems there's no lib natively offering all this...

Thanks a lot !

[-] Falmarri@lemmy.world 1 points 1 year ago

Oh, misread the post, no idea for C sorry. I would think it would be really hard for C to have a generic structured log library, but I'm not a C expert

[-] JustCopyingOthers@lemmy.ml 1 points 1 year ago

We use boost log at work, it seems to meet all the criteria you ask for. It is a bit heavy on the compiler though and logging gets used everywhere so expect your build times to go up.

[-] JustCopyingOthers@lemmy.ml 1 points 1 year ago

Sorry, just reread your post, boost is c++ and you want c

this post was submitted on 29 Aug 2023
4 points (100.0% liked)

C & C++

1 readers
3 users here now

founded 5 years ago
MODERATORS