Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Add log function for runtime types #35

Closed
isaachier opened this issue Nov 8, 2017 · 3 comments
Closed

Add log function for runtime types #35

isaachier opened this issue Nov 8, 2017 · 3 comments

Comments

@isaachier
Copy link
Contributor

As of now, a user must use an initializer list to log key-value pairs. The problem is, this effectively disables any dynamic logging. For example, if I want to log a list of key-value pairs, I have to know this list at compile time, seeing as no STL container can be converted into an initializer list at runtime.

Here are a few ideas for a new log function overload:

using Iterator = std::vector<std::pair<string_view, Value>>::const_iterator;
virtual void Log(Iterator first, Iterator last) noexcept = 0;

or

@isaachier
Copy link
Contributor Author

virtual void Log(const std::unordered_map<string_view, Value>& pairs) noexcept = 0;

@rnburn
Copy link
Contributor

rnburn commented Nov 8, 2017

What would you think of adding an overload for something like LogRecord that's in the Go API?

You can use it to customize the timestamp of the log as well.

@isaachier
Copy link
Contributor Author

I'd like that too. TBH, anything other than std::initializer_list is fine with me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants