traderepublic / Cilicon

🛠️ Self-Hosted ephemeral macOS CI on Apple Silicon
MIT License
950 stars 28 forks source link

Log with OSLog #43

Open HeEAaD opened 8 months ago

HeEAaD commented 8 months ago

Motivation

Observing the "SSH" log of the Cilicon.app requires to login to the host machine via remote desktop or VNC, because the log is not accessible on the command line.

Description

This PR logs all string that are logged to the "SSH" window also to the system log. Further its replaces all print statements with OSLog calls.

Examples

Get past "SSH" output:

log show --style compact --predicate 'subsystem=="com.traderepublic.cilicon" and category == "SSH"'

Get live "SSH" output:

log stream --style compact --predicate 'subsystem=="com.traderepublic.cilicon" and category == "SSH"'

Get all log messages (including debug and info):

log show --style compact --predicate 'subsystem=="com.traderepublic.cilicon"' --info --debug
Halle commented 8 months ago

Just a data point, something I like about Cilicon is that host logging of the session isn't a big consideration for the self-hosting threat model. Maybe this could be an opt-in debug feature only?

Marcocanc commented 8 months ago

@Halle good point, @HeEAaD or what about making it opt-out?

HeEAaD commented 8 months ago

I would not consider this as a debug feature. But I agree, it might be better to have logging to the system as an opt-in feature because it might be unexpected that the output ends up in the system log.