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
I was trying to get my [POP] logging to print to stderr rather than the default of stdout. I created a custom logging function with the same parameters as the original, as follows:
var popStderrLogger = func(lvl logging.Level, s string, args ...interface{}) {
...
}
Then I called the function as follows:
pop.SetLogger(popStderrLogger)
However, this results in:
cannot use popStderrLogger (type func("github.com/gobuffalo/pop/logging".Level, string, ...interface {})) as type pop.logger in argument to pop.SetLogger
I then tried casting the function to the private type as well; I didn't expect it to work, but it shows what I believe is the true cause of the error:
pop.SetLogger(popStderrLogger.(pop.logger))
cannot refer to unexported name pop.logger
The text was updated successfully, but these errors were encountered:
While I agree with you that the logger interface should be public (for documentation purposes and more), you should still be able to set a custom logger without any code changes.
Your popStderrLogger just seems to use the wrong type for logging.Level:
(For someone who faced a similar issue, and seeing this issue)
While #622's direction could be considerable, the issue's title is not true.
SetLogger(func(logging.Level, string, ...interface{}) works fine and exporting the variable logger is not necessary. (the real reason of the issue was already explained above comment)
I was trying to get my
[POP]
logging to print tostderr
rather than the default ofstdout
. I created a custom logging function with the same parameters as the original, as follows:Then I called the function as follows:
However, this results in:
I then tried casting the function to the private type as well; I didn't expect it to work, but it shows what I believe is the true cause of the error:
The text was updated successfully, but these errors were encountered: