midspace / Space-Engineers-Admin-script-mod

Modding script for Space Engineers with dozens of Admin commands for creating game scenarios or supporting servers.
44 stars 13 forks source link

Server logging and messaging #64

Open midspace opened 9 years ago

midspace commented 9 years ago

We need to improve the exception handling on the server side.

And we'll need to do something along the lines of Exception logging, and recording an exception count and datetime so an Admin is sent a message whenever they connect or are connected.

"1 new exception occurred in the Admin mod since you last logged in. Please see the Admin mod log file for details."

"A new exception occurred in the Admin mod. Please see the Admin mod log file for details."

Spcemarine commented 9 years ago

Yeah makes sense. Currently it only notifies the admin if there was an error while loading the cfg.

Spcemarine commented 9 years ago

I implemented a notifier that stores the notifications in a cache and sends it to all admins who are enlisted in the dedicated server's config or the to the host of a non dedicated server. The notification itself consists of a message that tells the admin what to do with the exception and where to find it in the log. Now, I wonder if we should store the notifications for a certain period of time (one or two weeks?) because all pending notifications will be lost. If we log it forever, we might have to store the notifications for a very long period of time.

midspace commented 9 years ago

Depends on how you are storing it. I only envisioned a DateTime of the last login, and an Int for a counter. I didn't think much further than that. :(

All exceptions should be stored, indefinitely I think. Until someone purposely deletes the log file. Message notifications should at least be permanent until they are read. And then become temporary.

Spcemarine commented 9 years ago

The notifications are very simple. They consist of a DateTime that is set when they are created and of a string that can be set to anything. I just thought if we'll have more types of notifications in future, we can add them easily and do not need to write everything anew.

If everything goes as planned, I'll create the commit today.