Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ option( Scarab_BUILD_CLI "Flag to enable the building of the command-line interf

option( Scarab_BUILD_PYTHON "Build python bindings" TRUE )

set( Scarab_LOGGER_DEFAULT_THRESHOLD "eTrace" CACHE STRING "Default threshold for printing: eTrace, eDebug, eInfo, eProg, eWarn, eError, eFatal" )

option( Scarab_ENABLE_LOGGER_DEBUG "Flag to enable debug printing for the logger itself" FALSE )

if( (Scarab_BUILD_CODEC_JSON OR Scarab_BUILD_CODEC_YAML OR Scarab_BUILD_AUTHENTICATION OR Scarab_BUILD_CLI) AND NOT Scarab_BUILD_PARAM )
Expand All @@ -58,6 +60,8 @@ if( Scarab_ENABLE_TESTING )
enable_testing()
endif()

add_compile_definitions( SCARAB_LOGGER_DEFAULT_THRESHOLD=${Scarab_LOGGER_DEFAULT_THRESHOLD} )

if( Scarab_ENABLE_LOGGER_DEBUG )
add_compile_definitions( SCARAB_LOGGER_DEBUG )
else( Scarab_ENABLE_LOGGER_DEBUG )
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3 13 2
3 13 3
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Types of changes: Added, Changed, Deprecated, Removed, Fixed, Security

## [Unreleased]

## [3.13.3] - 2025-10-06

### Changed

- Default threshold configurable with preprocessor macro and via CMake
- Splash screen callback added to main_app


## [3.13.2] - 2025-09-17

Expand Down
6 changes: 5 additions & 1 deletion library/cli/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ namespace scarab
f_use_config( a_use_config ),
f_auth_groups_key( "auth-groups" ),
f_auth_file_key( "auth-file" ),
f_auth()
f_auth(),
f_splash( [](){} ) // empty function with signature void()
{
set_global_verbosity( logger::ELevel::eProg );

Expand Down Expand Up @@ -162,6 +163,9 @@ namespace scarab
LPROG( applog, "Final configuration:\n" << f_primary_config );
LPROG( applog, "Ordered args:\n" << f_nonoption_ord_args );
}

f_splash();

return;
}

Expand Down
3 changes: 3 additions & 0 deletions library/cli/application.hh
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ namespace scarab
/// Authentication object
mv_referrable( authentication, auth );

/// Splash text callback
mv_referrable( std::function< void() >, splash );

//*************************
// Verbosity
//*************************
Expand Down
1 change: 1 addition & 0 deletions library/logger/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace scarab
{
// see the comment in logger.hh about why the a_make_logger_fcn callback is used instead of the virtual function call
t_logger = a_make_logger_fcn( a_name ); //this->make_logger( a_name );
t_logger->set_level( spdlog::level::level_enum(unsigned(logger::ELevel::SCARAB_LOGGER_DEFAULT_THRESHOLD)) );
spdlog::register_logger( t_logger );
}
return t_logger;
Expand Down
4 changes: 4 additions & 0 deletions library/logger/logger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "scarab_api.hh"
#include "typename.hh"

#ifndef SCARAB_LOGGER_DEFAULT_THRESHOLD
#define SCARAB_LOGGER_DEFAULT_THRESHOLD eInfo
#endif

/**
* @file logger.hh
* @brief Contains the logger class and macros
Expand Down
5 changes: 5 additions & 0 deletions testing/applications/test_basic_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ Usage: bin/test_basic_application [OPTIONS]

using namespace scarab;

LOGGER( slog, "basic_application" );

int main( int argc, char **argv )
{
logger::set_global_threshold( logger::ELevel::eDebug );

main_app the_main( false );

// this isn't strictly necessary, but tests the splash screen feature
the_main.splash() = [](){ LPROG( slog, "WELCOME TO BASIC APPLICATION!" ); };

CLI11_PARSE( the_main, argc, argv );

return 0;
Expand Down