Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Fix early startup logging #948

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Mar 27, 2020

Found by: michaelortmann
Patch by: michaelortmann
Fixes: #627

One-line summary:
Add -d (Show debug info) command line argument and fix putlog() to respect conmask.

Additional description (if needed):
Eggdrop reads console setting with log levels from config file.
But it is using putlog() with LOG_DEBUG before reading it.
There was no way to dynamically tell eggdrop, when LOG_DEBUG is wanted and when not for this early startup period.
So it was a static setting in eggdrop effectively disabling LOG_DEBUG until config file is read.
Because the early startup period was buggy regarding logging, another bug found its way into then code: putlog() did not respect conmask.
This PR adds -d (Show debug info) command line argument and fixes putlog() to respect conmask.

Test cases demonstrating functionality (if applicable):
Test 1 - BotA.conf console setting without d
Before:

$ ./eggdrop -nt BotA.conf 

Eggdrop v1.9.0+msgtags (C) 1997 Robey Pointer (C) 2010-2020 Eggheads
--- Loading eggdrop v1.9.0+msgtags (Fri Mar 27 2020)
Listening for telnet connections on 0.0.0.0:3333 (all).
Module loaded: blowfish        
Module loaded: dns             
Module loaded: channels        
Module loaded: server          
[...]

After:

$ ./eggdrop -nt BotA.conf 

Eggdrop v1.9.0+msgtags (C) 1997 Robey Pointer (C) 2010-2020 Eggheads
--- Loading eggdrop v1.9.0+msgtags (Fri Mar 27 2020)
Listening for telnet connections on 0.0.0.0:3333 (all).
Module loaded: blowfish        
Module loaded: dns             
Module loaded: channels        
Module loaded: server
[...]

$ ./eggdrop -ntd BotA.conf 
LANG: Language loaded: english
LANG: Section loaded: core
LANG: 391 messages of 432 lines loaded from ./language/core.english.lang
LANG: 391 adds, 0 updates to message table

Eggdrop v1.9.0+msgtags (C) 1997 Robey Pointer (C) 2010-2020 Eggheads
Allocated bind table unld (flags 1)
Allocated bind table time (flags 1)
Allocated bind table cron (flags 1)
Allocated bind table note (flags 0)
Allocated bind table nkch (flags 1)
Allocated bind table load (flags 1)
Allocated bind table link (flags 1)
Allocated bind table filt (flags 1)
Allocated bind table disc (flags 1)
Allocated bind table dcc (flags 0)
Allocated bind table chpt (flags 1)
Allocated bind table chon (flags 1)
Allocated bind table chof (flags 1)
Allocated bind table chjn (flags 1)
Allocated bind table chat (flags 1)
Allocated bind table bot (flags 0)
Allocated bind table bcst (flags 1)
Allocated bind table away (flags 1)
Allocated bind table act (flags 1)
Allocated bind table evnt (flags 1)
Allocated bind table die (flags 1)
Allocated bind table log (flags 1)
Allocated bind table tls (flags 1)
--- Loading eggdrop v1.9.0+msgtags (Fri Mar 27 2020)
Listening for telnet connections on 0.0.0.0:3333 (all).
Module loaded: blowfish        
Module loaded: dns             
Module loaded: channels        
Module loaded: server
[...]

Test 2 - BotA.conf console setting with d
Before:

$ ./eggdrop -nt BotA.conf 

Eggdrop v1.9.0+msgtags (C) 1997 Robey Pointer (C) 2010-2020 Eggheads
--- Loading eggdrop v1.9.0+msgtags (Fri Mar 27 2020)
Listening for telnet connections on 0.0.0.0:3333 (all).
Module loaded: blowfish        
Module loaded: dns             
Module loaded: channels        
Module loaded: server
[...]

After:

$ ./eggdrop -nt BotA.conf 

Eggdrop v1.9.0+msgtags (C) 1997 Robey Pointer (C) 2010-2020 Eggheads
--- Loading eggdrop v1.9.0+msgtags (Fri Mar 27 2020)
Listening for telnet connections on 0.0.0.0:3333 (all).
Module loaded: blowfish        
Module loaded: dns             
Module loaded: channels        
Allocated bind table wall (flags 1)
Allocated bind table raw (flags 1)
Allocated bind table rawt (flags 1)
Allocated bind table notc (flags 1)
Allocated bind table msgm (flags 1)
Allocated bind table msg (flags 0)
Allocated bind table flud (flags 1)
Allocated bind table ctcr (flags 1)
Allocated bind table ctcp (flags 1)
Allocated bind table out (flags 1)
Module loaded: server
[...]

$ ./eggdrop -ntd BotA.conf 
LANG: Language loaded: english
LANG: Section loaded: core
LANG: 391 messages of 432 lines loaded from ./language/core.english.lang
LANG: 391 adds, 0 updates to message table

Eggdrop v1.9.0+msgtags (C) 1997 Robey Pointer (C) 2010-2020 Eggheads
Allocated bind table unld (flags 1)
Allocated bind table time (flags 1)
Allocated bind table cron (flags 1)
Allocated bind table note (flags 0)
Allocated bind table nkch (flags 1)
Allocated bind table load (flags 1)
Allocated bind table link (flags 1)
Allocated bind table filt (flags 1)
Allocated bind table disc (flags 1)
Allocated bind table dcc (flags 0)
Allocated bind table chpt (flags 1)
Allocated bind table chon (flags 1)
Allocated bind table chof (flags 1)
Allocated bind table chjn (flags 1)
Allocated bind table chat (flags 1)
Allocated bind table bot (flags 0)
Allocated bind table bcst (flags 1)
Allocated bind table away (flags 1)
Allocated bind table act (flags 1)
Allocated bind table evnt (flags 1)
Allocated bind table die (flags 1)
Allocated bind table log (flags 1)
Allocated bind table tls (flags 1)
--- Loading eggdrop v1.9.0+msgtags (Fri Mar 27 2020)
Listening for telnet connections on 0.0.0.0:3333 (all).
Module loaded: blowfish        
Module loaded: dns             
Module loaded: channels        
Allocated bind table wall (flags 1)
Allocated bind table raw (flags 1)
Allocated bind table rawt (flags 1)
Allocated bind table notc (flags 1)
Allocated bind table msgm (flags 1)
Allocated bind table msg (flags 0)
Allocated bind table flud (flags 1)
Allocated bind table ctcr (flags 1)
Allocated bind table ctcp (flags 1)
Allocated bind table out (flags 1)
Module loaded: server
[...]

@michaelortmann
Copy link
Member Author

michaelortmann commented Apr 8, 2020

#847 changed the usage of -nt. -t now does what -nt did. and -n now logs early debug. this means, this PR could be OBE now, because after #847 was merged, you can now do -t and dont log early debug or -n and log early debug. -n now does something silimar to what this PR tried to do with -d.

Looks like some internal flags (con_chan and/or term_z) are different with -n and -t, and so is logging.

I dont know if this was intentional. We already discussed flags in #627 a little bit. But my idea of analyzing/changing term_z was rejected back then. This is why i developed this PR with a new solution. But it looks like #847 now changed this very term_z.

@michaelortmann michaelortmann changed the title Fix early startup logging (WIP) Fix early startup logging Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing debug log
1 participant