haimgel / display-switch

Turn a $30 USB switch into a full-featured multi-monitor KVM switch
https://haim.dev/posts/2020-07-28-dual-monitor-kvm/
MIT License
2.85k stars 112 forks source link

Add context to configuration and logging errors #40

Closed svend closed 3 years ago

svend commented 3 years ago

Add context configuration or logging errors.

Here is an example of an error with context information:

$ HOME=/root target/debug/display_switch
Error: failed to initialize logging

Caused by:
    0: failed to create directory: "/root/.local/share/display-switch"
    1: Permission denied (os error 13)
svend commented 3 years ago

BTW, should the application try to create the configuration directory? It is up to the user to create the configuration file, and the applications does not write to the configuration directory.