2

I am comparing CleanRoomLogger https://github.com/emaloney/CleanroomLogger with XCGLogger https://github.com/DaveWoodCom/XCGLogger. There are many similarities but XCG seemed to be better because

1) it provides filters on the basis of tags

2) easy integration to 3rd party libraries if we want to push the logs to the server

However, Cleanroomlogger claims that it logs faster because it is built on top of os_log. Does anybody know how XCG handles fast logging? Or any other merits of one over the other?

Thanks.

A_G
  • 2,260
  • 3
  • 23
  • 56
  • XCGLogger uses `print` for logging to the console: https://github.com/DaveWoodCom/XCGLogger/blob/master/Sources/XCGLogger/Destinations/ConsoleDestination.swift – dr_barto Feb 01 '18 at 06:45
  • Then wouldn't it be slower than cleanRoomLogger? – A_G Feb 01 '18 at 06:49
  • Maybe, I don't know the performance characteristics of `os_log`... but I assume the difference is minimal and only will become significant if you log _a lot_ of messages (talking about hundreds or thousands of messages per second); also keep in mind that in a production environment you usually disable logging to the console anyway and only write to a file and/or the network. While I don't know your concrete use case I'd suggest to go with what suits you better feature-wise. – dr_barto Feb 01 '18 at 07:23

1 Answers1

1

Currently XCGLogger does not use os_log. I (the developer of XCGLogger) haven't added support for it yet. However, since XCGLogger is modular, you could create a new log destination that uses os_log if you need it. I'd appreciate a pull request if you do so that I can add it to the project for others.

Apple's docs for os_log are here: https://developer.apple.com/documentation/os/logging

Alternatively, if you really need it in a short period of time, you could sponsor the development of it. Get in touch with me if you'd like to pursue that option.

Dave Wood
  • 13,143
  • 2
  • 59
  • 67