ggerganov / ggwave

Tiny data-over-sound library
https://youtu.be/Zcgf77T71QM
MIT License
1.94k stars 156 forks source link

Add interface for changing ggwave's internal logging #52

Closed ggerganov closed 3 years ago

ggerganov commented 3 years ago

ref #51

Using GGWave::setLogFile() it is now possible to change the log file used internally by ggwave, or disable it all together.

The C interface function is respectively ggwave_setLogFile()

I guess we can design a better interface in the future, but for now this seems to be simple enough and does the job.

gizahNL commented 3 years ago

Awesome :)

I see the global is not protected by a lock, so the function is not threadsafe (not a problem in my usecase), but it would be worthwhile to document it ;)

I'm assuming setting it to NULL disables logging all together?

ggerganov commented 3 years ago

Good point - will add comment that setLogFile() is not thread-safe and should not be called in parallel with other methods.

I'm assuming setting it to NULL disables logging all together?

Correct