What logging is good logging for your app?

前端 未结 7 1260
不思量自难忘°
不思量自难忘° 2021-02-05 18:13

So we\'ve discussed logging in passing at my place of work and I was wondering if some of you guys here could give me some ideas of your approaches?

Typically our scenar

7条回答
  •  不思量自难忘°
    2021-02-05 18:46

    For a typical desktop app, I'd store everything on the current session, and maybe store info messages for the past n sessions or up to x in size.

    I'm assuming that your messages are organized. We use 4 categories; errors, warnings, info, and trace. We're still figuring out what goes at which level. As I'm getting used to parsing log files, I generally say "log more". Don't sweat readability, you're probably gonna have to process the log file a bit before you can use it.

    In the end, find a good logging framework that allows you to control your spool usage on lifetime and storage space, and a proper api that minimizes the effect on your code. Ideally you just type info("waaah") or warning("waah") and the API does all the fancy tagging for you.

提交回复
热议问题