diff --git a/examples/client/client.cpp b/examples/client/client.cpp index f749abc..8d65fbf 100644 --- a/examples/client/client.cpp +++ b/examples/client/client.cpp @@ -9,6 +9,7 @@ void ShowLogger(); int main() { ShowLogger(); + ICEngine::StartApplication(); return 0; } @@ -34,11 +35,15 @@ void ShowLogger() { // You can have multiple log streams, ie console + file etc // You do not need to have the same streams for each logger #include - std::ofstream coreFileStream("core_logs.txt"); - std::ofstream appFileStream("app_logs.txt"); + // Create file streams and transfer ownership to the logger + // You need to create a unique pointer, because the logger will + // take ownership of the streams and clean them up when the app + // is complete + auto coreFileStream = std::make_unique("core_logs.txt"); + auto appFileStream = std::make_unique("app_logs.txt"); - ICEngine::Log::GetCoreLogger()->AddStream(&coreFileStream); - ICEngine::Log::GetAppLogger()->AddStream(&appFileStream); + ICEngine::Log::GetCoreLogger()->AddStream(std::move(coreFileStream)); + ICEngine::Log::GetAppLogger()->AddStream(std::move(appFileStream)); // You can log multiple different types with formatting int age = 30; @@ -68,4 +73,15 @@ void ShowLogger() { // LOG_FATAL: Logs a fatal error in the application layer. This will trigger the Fatal Handler, which you can override // The Fatal Handler provides a mechanism for handling unrecoverable errors gracefully, allowing you to define how the application reacts to fatal crashes // LOG_FATAL("This is an example of log fatal crash!"); -} \ No newline at end of file +} + +class DemoApp : public ICEngine::ICEApplication { +public: + void Run() override { + LOG_TRACE("Running demo app!"); + } +}; + +ICEngine::ICEApplication* ICEngine::CreateICEApplication() { + return new DemoApp(); +}