Not really. All approaches will effectively need the same approach. However I would do it like that:
metadata = :logger.get_process_metadata()
Task.Supervisor.start_child(fn ->
:logger.set_process_metadata(metadata)
my_task()
end)
So the my_task/0 will not need to know anything about logger metadata.
The reason why I use :logger API instead of Logger API is that using :logger directly do not require to change map to list and then list to map and instead just uses map directly.






















