Okay. So I've asked in the forums about how to tackle the issue that @tonystone presented at #44 here:
I chose to keep it separate for one primary reason which is that I don't want to force all Linux users to have to install systemd-dev just to use TraceLog. There are many applications that do not have a need for that Writer and just want to link to TraceLog and go.
I think that you're right, Tony. But I feel like it's better to have it be included by default. If you agree, the method provided in the forums opens up a (mostly) clear way.
But here's my justification for wanting it be included by default: in a server environment, where you'd be more restrictive on what packages you install, you'd (almost certainly) want to put your log entries in the system journal so that's alright.
That leaves us with the desktop users, both in Mac and Linux, and the users in mobile Darwin (iOS, WatchOS) platforms.
Let's first tackle where the Darwin (both desktop and mobile) users lie right now. As it stands, the 4.0.0 release gives them os_log
logging. If an app or library developer chooses to use it, no problem! And if they don't... good as well! The current TraceLog code wouldn't change at all.
That leaves us with the Linux desktop users. If you were in Windows, you'd be reticent to install anything and with good reason. But in Linux, specially if you're using apt-get
(Debian) or another trusted, signed repository, you know it doesn't contain malicious software, and can verify the integrity of the binaries. The two main concerns would then be (a) Breaking another package or (b) Binary size. In the case of Python packages, (a) is completely justified because setting it up correctly requires a bit of black magic. In this case, with libsystemd-dev
being a OS-provided library, that should never happen.
(b) Is the last concern. I went and looked up how much systemd-dev
weighs, and it's less than 1 MB!, which is actually less than I expected ๐
.
So all in all, I think it makes sense for it to be included by default.
Now from an API standpoint, I think we should either:
- Include OS logging in both (Darwin, Linux) platforms by default.
- Not include OS logging in both platforms, by default, and include it with a compile-time option (e.g by reading an environment variable at the Package manifest).
This would make the API uniform in all platforms, which brings a lot of benefits. Take for example a library author who wants to use TraceLog in the current configuration for OS logging, who might be testing it only on MacOS first. Then when they try to port it to Linux, they find themselves having to use a bunch of #if os(...)
, #elseif
statements because the TraceLog API they were using is not available under Linux.
If instead the API was uniform, when they started porting it to Linux they would install systemd-dev
and after that everything would behave in exactly the same way as it does on MacOS. And that, I think, would be a great relief ๐
I will write up on ideas of how to implement this afterwards because my hands are very tired at the moment ๐
Please, lemme know what you think ๐