# Logging
If you run into issues when using Simplygon you should always check the log for clues.
You can access the log in following ways:
# Log to stdout
If you want to get the log from stdout you should enable logging as soon as you initialize the Simplygon interface.
// Enable logging, will default to stdout
sg->SetGlobalEnableLogSetting( true );
// Run processing here...
// Enable logging, will default to stdout
sg.SetGlobalEnableLogSetting( true );
// Run processing here...
# Enable logging, will default to stdout
sg.SetGlobalEnableLogSetting( True )
# Run processing here...
# Log to file
If you want to get the log from a file you should enable logging as soon as you initialize the Simplygon interface.
// Enable logging and send the log to the default file (%SIMPLYGON_9_SHARED\Simplygon.log%)
sg->EnableLogToFile( Simplygon::ELogLevel::Info, Simplygon::ELogDecoration::Timestamp |
Simplygon::ELogDecoration::Thread |
Simplygon::ELogDecoration::Category );
// Run processing here...
// Enable logging and send the log to the default file (%SIMPLYGON_9_SHARED\Simplygon.log%)
sg.EnableLogToFile( Simplygon.ELogLevel.Info, (uint)(Simplygon.ELogDecoration.Timestamp |
Simplygon.ELogDecoration.Thread |
Simplygon.ELogDecoration.Category) );
// Run processing here...
# Enable logging and send the log to the default file (%SIMPLYGON_9_SHARED\Simplygon.log%)
sg.EnableLogToFile( Simplygon.ELogLevel_Info, Simplygon.ELogDecoration_Timestamp |
Simplygon.ELogDecoration_Thread |
Simplygon.ELogDecoration_Category )
# Run processing here...
// Enable logging and send the log to a specified file
sg->EnableLogToFile( Simplygon::ELogLevel::Info, Simplygon::ELogDecoration::Timestamp |
Simplygon::ELogDecoration::Thread |
Simplygon::ELogDecoration::Category,
"C:\\temp\\Simplygon.log" );
// Run processing here...
// Enable logging and send the log to a specified file
sg.EnableLogToFile( Simplygon.ELogLevel.Info, (uint)(Simplygon.ELogDecoration.Timestamp |
Simplygon.ELogDecoration.Thread |
Simplygon.ELogDecoration.Category),
"C:\\temp\\Simplygon.log" );
// Run processing here...
// Enable logging and send the log to a specified file
sg.EnableLogToFile( Simplygon.ELogLevel_Info, Simplygon.ELogDecoration_Timestamp |
Simplygon.ELogDecoration_Thread |
Simplygon.ELogDecoration_Category,
'C:\\temp\\Simplygon.log' )
# Run processing here...
# Errors and Warnings
If you want to access errors and warnings from the log directly in code you can use the following code.
// Run processing here...
// Check if an error occurred
if ( sg->ErrorOccurred() )
{
// Get all errors occured in processing
auto errors = sg->CreateStringArray();
sg->GetErrorMessages( errors );
}
// Check if a warning occurred
if ( sg->WarningOccurred() )
{
// Get all warnings occured in the processing
auto warnings = sg->CreateStringArray();
sg->GetWarningMessages( warnings );
}
// Run processing here...
// Check if an error occurred
if ( sg.ErrorOccurred() )
{
// Get all errors occurred in processing
var errors = sg.CreateStringArray();
sg.GetErrorMessages( errors );
}
// Check if a warning occurred
if ( sg.WarningOccurred() )
{
// Get all warnings occurred in the processing
var warnings = sg.CreateStringArray();
sg.GetWarningMessages( warnings );
}
# Run processing here...
# Check if an error occurred
if sg.ErrorOccurred():
# Get all errors occurred in processing
errors = sg.CreateStringArray()
sg.GetErrorMessages( errors )
# Check if a warning occurred
if sg.WarningOccurred():
# Get all warnings occurred in the processing
warnings = sg.CreateStringArray()
sg.GetWarningMessages( warnings )