Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Add cinder logger#35

Open
heisters wants to merge 30 commits intosimongeilfus:masterfrom
heisters:add-cinder-logger
Open

Add cinder logger#35
heisters wants to merge 30 commits intosimongeilfus:masterfrom
heisters:add-cinder-logger

Conversation

@heisters
Copy link
Copy Markdown
Contributor

Usage:

MyApp::MyApp()
{
    log::makeLogger< ui::Logger >();
}

void MyApp::update() {
    for ( auto & log : log::manager()->getLoggers< ui::Logger >() ) {
        log->draw( "Log" );
    }
}

@simongeilfus
Copy link
Copy Markdown
Owner

simongeilfus commented Feb 17, 2017

Sounds really cool.
Not sure I understand what's happening in your example's MyApp::update. Does it create a window named "Log" for each log?

@heisters
Copy link
Copy Markdown
Contributor Author

My understanding of LogManager::getLoggers is that it will only return registered loggers of the passed type. So, since the user only registered one ui::Logger, the getLoggers call would only return one logger. If the user registered more than one ui::Logger at initialization, they would need to adapt the code to label each window uniquely. Perhaps a clearer example would be:

void MyApp::update() {
    log::manager()->getLoggers< ui::Logger >()[ 0 ]->draw( "Log" );
}

That window will include all messages that the ui::Logger is configured to log, which is configurable with something like:

log::manager()->getLoggers< ui::Logger >()[ 0 ]->setLoggingLevel( log::LEVEL_ERROR );

Lastly, you could, of course, avoid the whole getLoggers dance if you do something like this in initialization:

std::shared_ptr< ui::Logger > m_uiLogger;
// ...
m_uiLogger = log::makeLogger< ui::Logger >();

Does that answer your question?

pholz and others added 25 commits March 15, 2017 09:28
Hopefully this will make it clearer how to get started.
Add vc2015 sample project to build for cinder 0.9.1
fix issue with failing assertion if deltatime < 0
update to latest imgui, fix GetClipboardTextFn, SetClipboardTextFn. fix addFont() glyps range
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants