Skip to content

DEBUG messages cleanup #9171

Berbe started this conversation in General
DEBUG messages cleanup #9171
May 1, 2021 · 1 comments · 3 replies

Berbe
May 1, 2021

This discussion is made to assess current usage of the DEBUG macro as a prerequisite to sort/clean them up.

net

7

  • HTTP URL
  • HTTP download length
  • UDP address

6

  • HTTP redirection
  • NewGRF data request & reply

5

  • Frame number

4

  • Frame ACK
  • Gamelist removal
  • UDP broadcast & server response

3

  • Network start & shutdown
  • Admin erroneous packets
  • Socket options
  • Local interfaces address

2

  • Admin commands
  • Client errors (connection + password)
  • Master Server messages
  • Client queries

1

  • Map generation
  • Listeners
  • Admin (dis)connection
  • Admin errors (unauthenticated, client error, bad parameters)
  • Bind/Connection errors
  • Client (dis)connection
  • Master Server advertisement (removal)

0

  • Map load errors
  • Synchronisation messages
  • Client errors (bad password)
  • Bad packets/datagrams
  • Link problems troubleshoot
  • RCON errors
  • Autorestart

Replies

1 comment
·
3 replies

TrueBrain
May 11, 2021
Maintainer

I was looking through the list, and mostly realise I still wouldn't really know where to put a new debug message. At the same time I realised that this is a solved problem. So I am wondering, shouldn't we just use default logging facility stuff, so basically: fatal / error / warning / info / debug.

  • Fatal: an error we cannot recover from. You can expect degraded performance because of it.
  • Error: an error we recovered from, for example by showing a (clear) error to the user.
  • Warning: things that are not right, but also not wrong.
  • Info: things worth mentioning to the user if he is interested.
  • Debug: not useful for anyone except when debugging a problem.

When I map that to the DEBUG entries we have, you get something like:

0 - Fatal - cannot bind, cannot create socket, cannot redirect DEBUG, cannot open file, setting non-blocking fails, illegal packet received
1 - Error - disconnect from server, connection lost, broadcast failed
2 - Warning - "loading game failed, so a new game will be started", wrong password, invalid chat action, not supported (admin stuff)
3 - Info - client connected, starting network, shutdown network
4 - ??
5 - Debug 1 - DNS resolvement, connection attempts, server responses
6 - Debug 2 - Details DNS resolvement, HTTP connect, redirect, download status
7 - Trace - Received frame / sent frame

And we change the Dedicated server to be on net=4 (instead of net=6)

Here are all the current net logs in the game, which helped me to get a bit of feeling for it:
https://gist.github.com/TrueBrain/43a8e8960c281d22b89ac22619204114

What do you think?

3 replies
@Berbe

Berbe Sep 5, 2021
Author

That's a nice start, and I guess the current state is such a mess (I suppose due to historical "visual flying"), redefining the whole debug levels system from a blank specifications canvas is a good idea.

What about the following?

  1. Let's see if/how eveything fits in the system you suggest and whether we run into an undecided for some debug directives?
  2. Either:
    • Everything fits, we move 5-7 to 4-6 and jump to 3.
    • Back to the drawing board to respecify levels based on the undecided cases, and jump to 1.
  3. Jump to 5.
  4. Come on!
  5. Jump to 4.

Also, DNS resolution ;o)

@TrueBrain

TrueBrain Sep 5, 2021
Maintainer

We kinda already implemented this a while ago :) Not sure why this discussion was not linked ;) But the above information is what is currently implemented for 12.0-beta :) And we found nothing that didn't fit the above while doing so :)

Edit: grr, it was linked, GitHub just doesn't show that: #9251

@Berbe

Berbe Sep 5, 2021
Author

Encountering bugs in their move to Discussions? Shocking!

If you haven't run into problems: that's fantastic!
I notice you haven't moved 5-7 to 4-6: Might this be on the roadmap for the next beta/release candidate/release?

Even if it's not 100%, there is nothing wrong in making debug messages be rewritten in the future anyway.
What will the default debug level for dedicated servers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
General
2 participants
Converted from issue