andygrunwald / andygrunwald/things-with-buzzers-websocket

Replace stdlib "log" with structured logging "logrus"

Đang mở
#2 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Go
Star
10
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Right now we use the stdlib "log" package for logging:

```
➜ things-with-buzzers-websocket git:(master) ./twb-websocket
2019/09/29 13:15:38 ******************************************
2019/09/29 13:15:38 things with buzzers: websocket
2019/09/29 13:15:38 ******************************************
2019/09/29 13:15:38 Software buzzer requested
2019/09/29 13:15:38 Starting socket broadcast
2019/09/29 13:15:38 Webserver starting on :8080
2019/09/29 13:15:38 Buzzer emulator: tcp socket starting on :8181
2019/09/29 13:16:27 New client registered: [::1]:8080
2019/09/29 13:16:45 Buzzer emulator: client connected: [::1]:53104
2019/09/29 13:16:49 Buzzer emulator: message received from client [::1]:53104: /yellow
2019/09/29 13:16:49 Buzzer pressed: yellow
2019/09/29 13:16:49 Buzzer emulator: message sent to client [::1]:53104: OK
2019/09/29 13:16:49 Broadcasting message: {"Color":"yellow"}
2019/09/29 13:16:54 Buzzer emulator: message received from client [::1]:53104: /yellow
[...]
```

It would be cool if we could switch to [logrus](https://github.com/sirupsen/logrus).
This enables a colorful output and structured logging based on fields.

For the software buzzer emulator this would work fine because there, we have the logging 100% under our control.
When we enable the hardware buzzers, [gobot](https://github.com/hybridgroup/gobot) also starts to log with the stdlib log package.

Mixing both would end up in an ugly and unreadable logging state. There are smaller ambitions to switch to logrus inside gobot. See https://github.com/hybridgroup/gobot/issues/508

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.