Skip to content

GM-117868: Adds parse transform for Level/3 function to pass submeta as map#2

Open
amarBitMan wants to merge 1 commit intomainfrom
feature-log-submeta
Open

GM-117868: Adds parse transform for Level/3 function to pass submeta as map#2
amarBitMan wants to merge 1 commit intomainfrom
feature-log-submeta

Conversation

@amarBitMan
Copy link

@amarBitMan amarBitMan commented Aug 16, 2023

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.

@amarBitMan amarBitMan requested review from a team and srijan August 16, 2023 06:07
{Meta, SubMeta, Message, Arguments};
break_args(DefaultAttrs, Line, Args) ->
{Meta, Message, Arguments} = handle_args(DefaultAttrs, Line, Args),
{Meta, {map, Line, []}, Message, Arguments}.
Copy link
Author

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, []}

output({metadata, "=", " "}, Msg);
output({metadata, IntSep, FieldSep}, Msg) ->
MD = lists:keysort(1, lager_msg:metadata(Msg)),
MD = lists:usort(lager_msg:metadata(Msg)),
Copy link
Author

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.

_ ->
Format
end,
io:format("Metadata = ~p, SubMeta = ~p", [Metadata, SubMeta]),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@amarBitMan amarBitMan changed the title GM-117868: Adds parse transform for Level/4 function GM-117868: Adds parse transform for Level/3 function Aug 16, 2023
@amarBitMan amarBitMan changed the title GM-117868: Adds parse transform for Level/3 function GM-117868: Adds parse transform for Level/3 function to pass submeta as map Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant