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
An issue arises if the new(-ish) logging macros (kernel/include/logger.hrl) are included alongside wf.hrl, specifically, ?LOG is redefined. I cannot see a 100% backwards compatible solution to this problem as logger:?LOG accepts different arguments than wf:?LOG. (It's entirely possible my understanding of how includes works is faulty or incomplete.)
If this is something that should be addressed in Nitrogen, I'd propose a solution like
This is an incomplete (and not well tested) solution! wf:info/1,2; wf:warning/1,2; and wf:error/1,2 will continue to use the legacy logging infrastructure. Further, the alternate macros do not take advantage of the enhanced metadata the new logging facility provides (which would require, I think, a custom log formatter).
I'm happy to submit a PR addressing this issue, either along these lines or a better solution arising from discussion. Before continuing however, I think it's important to acknowledge the compatibility issue that will arise and determine how it should be managed. It seems to be worth noting that the incompatibility is triggered by the developer opting to include the new macros; the default logging should just work in the vanilla case.
The text was updated successfully, but these errors were encountered:
For the sake of consistency, I'd go with ?WF_LOG only because the other ?WF macro (?WF_IF) uses ?WF_ as the prefix instead of ?WF (without the underscore).
In this situation, I'm not super concerned with backwards compatibility being a problem, since it's a pretty easy s/LOG/WF_LOG kind of solution.
Hola @bunnylushington and @choptastic, is anyone working on this one? We are migrating some production pages to a new system built on Erlang and Nitrogen and just discovered this conflict. It would be really helpful to be able to use the OTP logger macros without having to refactor all the Nitrogen stuff into a separate module. I'd be happy to try my hand at a PR if that would help get the ball rolling, though I'm admittedly not sure how to address the deeper questions about wf:info et al using the legacy logging setup.
An issue arises if the new(-ish) logging macros (
kernel/include/logger.hrl
) are included alongsidewf.hrl
, specifically,?LOG
is redefined. I cannot see a 100% backwards compatible solution to this problem as logger:?LOG accepts different arguments than wf:?LOG. (It's entirely possible my understanding of how includes works is faulty or incomplete.)If this is something that should be addressed in Nitrogen, I'd propose a solution like
which allows for both hrl files to be included, in this order:
This is an incomplete (and not well tested) solution! wf:info/1,2; wf:warning/1,2; and wf:error/1,2 will continue to use the legacy logging infrastructure. Further, the alternate macros do not take advantage of the enhanced metadata the new logging facility provides (which would require, I think, a custom log formatter).
I'm happy to submit a PR addressing this issue, either along these lines or a better solution arising from discussion. Before continuing however, I think it's important to acknowledge the compatibility issue that will arise and determine how it should be managed. It seems to be worth noting that the incompatibility is triggered by the developer opting to include the new macros; the default logging should just work in the vanilla case.
The text was updated successfully, but these errors were encountered: