otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.59k stars 1.06k forks source link

Logging subsystem #2221

Open djarek opened 7 years ago

djarek commented 7 years ago

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:

ranisalt commented 7 years ago

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.

Nu77 commented 7 years ago

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

djarek commented 7 years ago

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.

securmk commented 7 years ago

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.

Zbizu commented 2 years ago

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