38 if (args.count(
"help")) {
44 CONSOLIX_SET_DEBUG_MODE(config.debug_mode);
49 CONSOLIX_UNIQUE_FILE_STREAM() <<
"Test 123";
50 LOGIT_PRINT_INFO(
"Unique log file: ", CONSOLIX_UNIQUE_FILE_NAME());
62 for (
auto &item : config.items) {
67 std::this_thread::sleep_for(std::chrono::milliseconds(config.period));
75 CONSOLIX_STREAM() <<
"Application is shutting down. Received signal: " << signal;
79int main(
int argc,
char* argv[]) {
89 "A demonstration program showcasing the features of the Consolix library, "
90 "including logging, configuration management, and command-line argument parsing.",
91 [](consolix::CliOptions& options){
93 (
"c,config",
"Path to the configuration file", cxxopts::value<std::string>())
94 (
"d,debug",
"Enable debugging mode", cxxopts::value<bool>()->default_value(
"false"))
95 (
"p,period",
"Period in milliseconds", cxxopts::value<int>()->default_value(
"10"))
96 (
"h,help",
"Show help message");
97 options.allow_unrecognised_options();
105 "config.json",
"config");
#define CONSOLIX_STREAM()
Fallback for general logging.
Custom loop component for the main application logic.
virtual ~CustomLoop()=default
bool on_once() override
Called once at the start of the loop.
void on_loop() override
Called repeatedly during the execution loop.
void on_shutdown(int signal) override
Called during application shutdown.
Abstract base class for application components with looping functionality.
Entry point for including all core headers of the Consolix framework.
ColorManipulator color(TextColor color)
Creates a color manipulator for use in output streams.
std::shared_ptr< Component > add(Args &&... args)
Adds a new component to the application. Creates a new instance of the specified component type and a...
T & get_service()
Retrieves a resource globally. Retrieves a reference to a globally registered resource from the Servi...
void run()
Runs the application. Processes all components in the application's main loop.
Application configuration structure.
bool debug_mode
Enable or disable debugging mode.
std::vector< std::string > items
List of items to display.
int period
Delay between loop iterations in milliseconds.
std::string text
Text to display in each loop iteration.