You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
It is allowed by the developer to construct a Entry struct (field are public), but you supply no way to submit the entry to a handler correctly using the HandleLog function.
How?
The Entry struct requires to be finalized, which can only be obtained using the private, which is only called here:
Hmmm tough call, I feel like exposing .finalize would be a little gross, but I see what you mean. I think the part I dislike the most right now is that Entry.Logger, it would be nice if we could just pass an Entry to the handler without any reference to that
I agree. Finalizing the Entry should be transparent to the developer. But with no gab between the actual Entry and the HandleLog function, figuring out a solution is tricky. Could we possibly do without a finalize method at all? The developer will be responsible for settings the timestamp on the Entry themselves (this would of course still be handled in the higher level functions Info, WarnError etc.)
Problem:
It is allowed by the developer to construct a
Entry
struct (field are public), but you supply no way to submit the entry to a handler correctly using theHandleLog
function.How?
The
Entry
struct requires to be finalized, which can only be obtained using the private, which is only called here:log/logger.go
Line 146 in ff0f669
Logger
struct, which does not support theHandleLog
functionWhy?
Sometimes the developer may want to have complete control of the logging (e.g. setting the log level of the entry dynamically)
Possible solutions:
HandleLog
functions and call finalize beforehandHandleLog
to theLogger
struct and call finalizeYou are probably more suited to find a proper solution yourself. Your thoughts?
The text was updated successfully, but these errors were encountered: