forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

Logging subsystem

Open djarek opened this issue 7 years ago • 5 comments

There are a lot of inconsistencies in the way we present logs to the user. In order to make logging uniform throughout the codebase we need a unified, preferably typesafe logging subsystem. On POSIX compliant systems the logs should be directed either to stdout or to syslog(). The logging subsystem should provide 3 log levels:

  • Info (global events like server reload or player log in/log out)
  • Error/Warning (maybe split these?) - when something went wrong
  • Debug - by default disabled, can be enabled with a cmake flag (not sure if we need this, GDB is awesome)

djarek avatar Mar 27 '17 21:03 djarek

I have this small, nice library that outputs colored, namespaced logging: https://gist.github.com/ranisalt/639a4ab5717937c0bd349e95f8cb9dc7

I could improve it in order to add to TFS. It's header only and works this way: logger << "Some message " << some_var << 123 << logger::endl; And it outputs the full line with the namespace at the beginning.

ranisalt avatar Mar 28 '17 00:03 ranisalt

👍 for colored output Did it when bored and things looks so much better now (only on otserv.cpp though) alt text

Nu77 avatar Mar 28 '17 19:03 Nu77

Not sure how the coloring of logs works with syslog/journald (would be nice if you could daemonize TFS using systemd and view its logs using journalctl.

djarek avatar Mar 28 '17 19:03 djarek

https://github.com/securmk/TFSLogger

I've created this while I was bored. It has some ugly parts but I'm just too lazy to solve them. It's based in original CIP files' logger.

securmk avatar May 14 '17 13:05 securmk

I'm looking through old issues today and coincidentally it's what I've been working on today https://github.com/Zbizu/forgottenserver/commit/ec2cf008dd3aca891745938b32af37b1c398327b https://github.com/Zbizu/forgottenserver/commit/da311f22a353a74ec8ee6aab3e73805758040bab

let me know if you're interested

Zbizu avatar Mar 28 '22 00:03 Zbizu