• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request for cleaner library logs in the console
#1
Request for plugin/include developers to stop doing shit like this:
Code:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team

gamemodetext = "Unknown" ?(string)
password = "" ?(string)
bind = "" ?(string)
nosign = "" ?(string)

Server Plugins
--------------
Loading plugin: mysql
>> plugin.mysql: R41-4 successfully loaded.
?Loaded.
Loading plugin: sscanf


===============================

? ? ?sscanf plugin loaded. ? ?

? ? ? ? Version: ?2.8.3 ? ? ? ?

?(c) 2018 Alex "Y_Less" Cole ?

===============================

?Loaded.
Loading plugin: streamer


*** Streamer Plugin v2.9.4 by Incognito loaded ***

?Loaded.
Loading plugin: FCNPC

-------------------------------------------------
? ? FCNPC - Fully Controllable NPC v2.0.0
? ? ? ? ? ?Windows SA-MP 0.3.7 R2
? ? ? ? ? Jun 25 2019 at 00:12:08

?Author: ? ? ? OrMisicL (2013 - 2015)
?Continued by: ziggi ? ?(2016 - present)

?See full credits in the README.md file
-------------------------------------------------

Loading...

-------------------------------------------------
? ColAndreasv1.4.0

? Created By:
? ? [uL]Chris42O
? ? [uL]Slice
? ? [uL]Pottus
-------------------------------------------------

Loading...
ColAndreas v1.4.0 Loaded.
?Loaded.
Loading plugin: timerfix
?>> TimerFix v1.5 successfully loaded.
?Loaded.
Loading plugin: YSF
ARRAY_ConsoleCommands: 4e43d8


===============================

? ? ? ?YSF - kurta999's version R19 loaded

? (c) 2008 Alex "Y_Less" Cole - (c) 2010 - 2016 kurta999

? ?Server version: 0.3.7 R2-1

? ?Operating System: Windows

? ?Built on: Mar 11 2017 at 10:32:34

===============================

?Loaded.
Loaded 6 plugins.


Started server on port: 7777, with maxplayers: 50 lanmode is OFF.


Filterscripts
---------------
?Loading filterscript 'example.amx'...
Loaded collision data.
?Loaded 1 filterscripts.

[MySQL] Error: 2002 Can't connect to MySQL server on 'localhost' (10061).
Loading Map.
Loaded Map.
Number of vehicle models: 94

--- Server Shutting Down.
plugin.mysql: Unloading plugin...
plugin.mysql: Plugin unloaded.


===============================

? ? sscanf plugin unloaded. ? ?

===============================



*** Streamer Plugin v2.9.4 by Incognito unloaded ***

FCNPC Unloaded.
[plugin.timerfix] Plugsin successfully unloaded!


==============

?YSF - kurta999's version R19 unloaded

==============

Example of what it could be, without all of this cluttering:
Code:
SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team

Plugins
--------------
?Loading plugin: mysql
vR41-4
? Loaded.
?Loading plugin: sscanf
v2.8.3
? Loaded.
?Loading plugin: streamer
v2.9.4
? Loaded.
?Loading plugin: colandreas
v1.4.0
? Loaded.
?Loading plugin: FCNPC
v2.0.0
? Loaded.
?Loading plugin: timerfix
v1.5.0
? Loaded.
?Loading plugin: YSF
vR19
? Loaded.
?Loaded 7 plugins.

Filterscripts
---------------
?Loading filterscript: example
? Loaded.
?Loaded 1 filterscripts.

Gamemode
---------------
?Loading gamemode: bare
[MySQL] Error: 2002 Can't connect to MySQL server on 'localhost' (10061).
[ColAndreas] Info: Loading collision data.
[ColAndreas] Info: Loading Map.
? Loaded.

--- Server Shutting Down.
?Unloading gamemode: bare
? Unloaded.

?Unloading plugin: mysql
? Unloaded.
?Unloading plugin: sscanf
? Unloaded.
?Unloading plugin: streamer
? Unloaded.
?Unloading plugin: colandreas
? Unloaded.
?Unloading plugin: FCNPC
? Unloaded.
?Unloading plugin: timerfix
? Unloaded.
?Unloading plugin: YSF
? Unloaded.
?Unloaded 7 plugins.

Now ask yourself,?which of these 2 examples?would?you like to consult, when for once?you really really need to.

Some of this is clutter is baked into the server itself, but arguably?those logs are somewhat useful. However, pretty much all of the logs done during?plugin/include init and exit?have no benefit, except for maybe the version number during init.
Why is this credits clutter so?necessary? It's annoying and makes your logs actually less readable and useful. Imagine if every time?you used a third party?library in C and started your program, some credits shit about that library gets printed to the console. Sometimes those libraries are written by lots and lots of people. Now imagine not using just 1 third party library...?For some reason this is just a thing that happens in this community. I'm guessing because 1 person did it in the early days and everyone else just followed.
So, I propose a few guidelines for readable,?consistent and?actually useful?logs:
  1. On plugin/include init, only print the version number?using the following format: v1.0.0
  2. On plugin/include exit, don't print anything.
  3. During the lifetime of the plugin/include, use one of these formats for different types of messages:
    • Info messages:?[LIBRARY_NAME] Info: YOUR_MESSAGE.
    • Error messages:?[LIBRARY_NAME] Error: YOUR_MESSAGE.
    • Warning messages:?[LIBRARY_NAME] Warning: YOUR_MESSAGE.
  4. You can break rule 1 and 2 only if you're absolutely sure that what you need to log is very useful information and that you?use the formats from rule 3.
What follows?are?examples for each rule, taken from the cleaned up code snippet above.

Rule 1:
Just the version number,?preferably using semantic versioning.
Code:
v2.8.3

Rule 2:
Nothing, as mentioned.
Code:
?

Rule 3:
Info and error messages.
Code:
[ColAndreas] Info: Loading Map.
[MySQL] Error: 2002 Can't connect to MySQL server on 'localhost' (10061).

Rule 4:
Loading the ColAndreas collision data is useful information to know.
Code:
[ColAndreas] Info: Loading collision data.

I'm not asking for people not to be credited for their work. I'm asking to stop this stupid console cluttering.
Now, let's all start doing this and Make Logs Great Again!

Log and config files:
Adding to this, when a library has its own dedicated log file (e.g. mysql.log) it should go in the?logs?folder in the root of the server directory. Alternatively, if the library uses more than 1 log file, all those files should be together in a folder (e.g. logs/mysql). Configuration files (e.g. YSF.cfg) should go in the configs?folder in the root of the server directory. Alternatively, if the library uses more than 1 config file, all those files should be together in a folder (e.g. configs/mysql).
Always keep in mind that a lot of people are active on this forum in their spare time.

They are sacrificing time they could easily spend on things they would rather do, to help you instead.

  Reply


Messages In This Thread
Request for cleaner library logs in the console - by Freaksken - 2019-06-27, 05:32 AM

Forum Jump: