Skip to content

Conversation

@PatKamin
Copy link
Contributor

Replace extern logger object with a singleton one. Remove the need for initializing logger when logger is not used.

Add printing logger name at the beginning of messages.

template <typename... Args>
void log(logger::Level level, const char *fmt, Args &&...args) {
*ostream << "<" << logger_name << ">";
*ostream << "[" << level_to_str(level) << "]:";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there should be a space after :

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@igchor igchor left a comment

Choose a reason for hiding this comment

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

LGTM


Logger create_logger(std::string logger_name);

inline Logger &get_logger(std::string name = "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This means that tests and other places you log without explicit init will print <>[INFO]: message. Maybe instead we can use 'common' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@PatKamin PatKamin force-pushed the logger-singleton branch 2 times, most recently from b4eecd2 to 54edea0 Compare March 13, 2023 14:08
Replace extern logger object with a singleton one. Remove the need for
initializing logger when logger is not used.

Add printing logger name at the beginning of messages.
@pbalcer pbalcer merged commit 22c6e96 into oneapi-src:main Mar 13, 2023
@PatKamin PatKamin deleted the logger-singleton branch June 26, 2024 10:05
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.

3 participants