From 0704ca055059088bdd53e15be672e6b5663b8f50 Mon Sep 17 00:00:00 2001 From: paradust7 <102263465+paradust7@users.noreply.github.com> Date: Wed, 4 May 2022 11:55:01 -0700 Subject: Make logging cost free when there is no output target (#12247) The logging streams now do almost no work when there is no output target for them. For example, if LL_VERBOSE has no output targets, then `verbosestream << x` will return a StreamProxy with a null target. Any further `<<` operations applied to it will do nothing. --- src/client/game.cpp | 2 +- src/client/renderingengine.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/client') diff --git a/src/client/game.cpp b/src/client/game.cpp index e0e60eb2c..1e34ca286 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1491,7 +1491,7 @@ bool Game::connectToServer(const GameStartData &start_data, client->m_simple_singleplayer_mode = simple_singleplayer_mode; infostream << "Connecting to server at "; - connect_address.print(&infostream); + connect_address.print(infostream); infostream << std::endl; client->connect(connect_address, diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 723865db4..455d5e538 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -116,7 +116,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver) } SIrrlichtCreationParameters params = SIrrlichtCreationParameters(); - if (g_logger.getTraceEnabled()) + if (tracestream) params.LoggingLevel = irr::ELL_DEBUG; params.DriverType = driverType; params.WindowSize = core::dimension2d(screen_w, screen_h); -- cgit v1.2.3