Open tharvik opened 5 years ago
That will be difficult to achieve given the compile-time plugin structure of protocols and services.
If I understand your proposition correctly, you would like to replace the automatic registration of protocols and services with something more user-controlled.
Can you be more specific what you're actually trying to achieve?
If I understand your proposition correctly, you would like to replace the automatic registration of protocols and services with something more user-controlled.
In the long run, that would be best; but maybe, it's reaching larger than the scope of this issue.
Can you be more specific what you're actually trying to achieve?
I'm writing a small CLI which generates a Roster configuration, but outputing this config to stdout gets it gets mangled with the logging from onet.
So you either write it to a file or put DEBUG_LVL=0
when calling it...
So you either write it to a file or put
DEBUG_LVL=0
when calling it...
I can work around it, that's not the issue. The issue is that I don't have a normal/obvious way to control os.Stdout
when using onet, it get mixed with intended output and library output. IMO, it's akin to having a library calling os.Exit
when receiving a malformed message.
I want to output something to stdout without having the logger writing it on. The issue is that it's already writing quite early on (via the
func init
construct).gives with
DEBUG_LVL=4
A working way to do it (but ugly), is to create a dedicated pkg just containing the
OutputToBuf
call inside aninit
, then importing it before anything else.A better way to fix it would be to avoid
init
everything, especially if the func called have side effects. That's the main issue IMO, thatinit
(and its combo, global variables) is used as a way to avoid having a dedicated struct to contain the state of a given part.