Skip to content

Commit

Permalink
Use custom logging function to suppress default o2 library debug mess…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
nyalldawson committed Nov 26, 2024
1 parent c8b47e6 commit 3291e9f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/auth/oauth2/core/qgso2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ QgsO2::QgsO2( const QString &authcfg, QgsAuthOAuth2Config *oauth2config,
, mAuthcfg( authcfg )
, mOAuth2Config( oauth2config )
{
static std::once_flag initialized;
std::call_once( initialized, [ = ]( )
{
setLoggingFunction( []( const QString & message, LogLevel level )
{
#ifdef QGISDEBUG
switch ( level )
{
case O0BaseAuth::LogLevel::Debug:
QgsDebugMsgLevel( message, 2 );
break;
case O0BaseAuth::LogLevel::Warning:
case O0BaseAuth::LogLevel::Critical:
QgsDebugError( message );
break;
}
#else
( void )message;
( void )level;
#endif
} );
} );

initOAuthConfig();
}

Expand Down

0 comments on commit 3291e9f

Please sign in to comment.