-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GM-117868: Adds parse transform for Level/3 function to pass submeta as map #2
base: main
Are you sure you want to change the base?
Conversation
{Meta, SubMeta, Message, Arguments}; | ||
break_args(DefaultAttrs, Line, Args) -> | ||
{Meta, Message, Arguments} = handle_args(DefaultAttrs, Line, Args), | ||
{Meta, {map, Line, []}, Message, Arguments}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default SubMeta = #{}
.
AST for #{}
-> {map, Line, []}
@@ -96,7 +96,7 @@ output(sev,Msg) -> | |||
output(metadata, Msg) -> | |||
output({metadata, "=", " "}, Msg); | |||
output({metadata, IntSep, FieldSep}, Msg) -> | |||
MD = lists:keysort(1, lager_msg:metadata(Msg)), | |||
MD = lists:usort(lager_msg:metadata(Msg)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove duplicates, case where submeta and meta both have the same KVs.
@@ -149,8 +152,10 @@ do_log_impl(Severity, Metadata, Format, Args, SeverityAsInt, LevelThreshold, Tra | |||
_ -> | |||
Format | |||
end, | |||
io:format("Metadata = ~p, SubMeta = ~p", [Metadata, SubMeta]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
With this change, we can use
Sink:Level/4
function.Where the first arg of this function will be a map of all key-value pairs to be prepended to Msg String.