loguru icon indicating copy to clipboard operation
loguru copied to clipboard

[Question] Allow the compile time switches to be optional or runtime switches?

Open dcermak opened this issue 5 years ago • 1 comments

First and foremost, thanks for loguru, awesome library!

I have the long term plan to package loguru and get it included into openSUSE, to be able to package cquery. Unfortunately I am facing a practical problem: nearly every linux distribution requires that libraries cannot be included as source only and have to be built as shared libraries.

Now, loguru offers a lot of compile time switches, which make a distribution as a shared library inconvenient. Most of these are probably unproblematic, as they only add features, but for instance LOGURU_USE_FMTLIB changes the libraries behavior. LOGURU_WITH_FILEABS and LOGURU_UNSAFE_SIGNAL_HANDLER are probably problematic too, but I haven't checked in detail.

Would you consider the option to convert some of these preprocessor #defines to runtime switches? E.g. LOGURU_UNSAFE_SIGNAL_HANDLER should be resolvable at runtime without a large performance hit. LOGURU_USE_FMTLIB could be maybe removed by exploiting some form of function overloading.

This would ease packaging for Linux distributions tremendously.

dcermak avatar Dec 20 '18 14:12 dcermak

I agree that porting some of these switches from compile-time to runtime would be a good idea. Pull requests welcome =)

emilk avatar Jan 27 '19 16:01 emilk