-
Notifications
You must be signed in to change notification settings - Fork 22
[RFC] log.Logger interface #15
Comments
The solve tracer discussed in #5 will probably get its own logger, for which a However, there are other other classes of errors, and/or additional info about what the solver/ So, yeah...no question that |
@sdboyer Setting the logging mechanism is more of an application level piece than a library level piece. A library should not force the logger to use but instead work with a variety. With that, let me propose this. Have a debug mode that is passed around. Then the implementing application can set the mode and pass in a logger. Then the logger writes debug output if the debug mode is set. Then logrus only needs to be in the tests and maybe the example code. |
Deciding how logging data is ultimately directed is certainly an application level decision. Deciding how to encode events as log data, however, is not. There is a substantial conceptual difference between leveled and unleveled loggers, and the debate between their uses is long and storied.
You already have access to a debug mode: set the output level on the injected logger to I'm open to being convinced to drop the leveled logger (though your interest in doing so strikes me as odd, given that glide's So, I need you to make a specific argument that addresses how a non-leveled, non-metadata-carrying logger is supposed to express...well, logging levels. Or, make a case for why logging levels aren't necessary - and ideally, tailor that argument to the particulars of this case. Additionally, please address the points that I've raised:
|
I've thought about this some more. For what
|
doing this in #21 |
A basically-OK version of this is now integrated into master. Here's the output now generated from |
vsolver currently uses logrus. This can be really useful for testing. When vsolver is integrated into external applications the logger from that application should be used.
The proposal is switch vsolver to a standard
log.Logger
interface. In the testing use logrus to generate the output as needed. This can even be used in examples. logrus implements thelog.Logger
interface so it can be used.This will help vsolver be a better library when imported into applications. It can use the native logging capabilities of the application.
Thoughts?
The text was updated successfully, but these errors were encountered: