RSTools 3.1.0
Versatile C++20 utility library
Loading...
Searching...
No Matches
ScopedTimer.hpp File Reference
#include "RST/log/Log.hpp"
#include "RST/log/LogRegistry.hpp"
#include <chrono>
#include <memory>
#include <string>
#include <utility>

Go to the source code of this file.

Classes

class  RST::Log::ScopedTimer
 Logs the time spent in a scope when destroyed, usually through RST_LOG_SCOPE_TIME(). More...
 

Namespaces

namespace  RST
 Root namespace of RSTools.
 
namespace  RST::Log
 Thread-safe logging: loggers, sinks, patterns and macros.
 

Macros

#define RST_LOG_SCOPE_TIME(logger, name)
 Times the rest of the current scope and logs it at debug level on logger.
 
#define RST_LOG_SCOPE_TIME_DEFAULT(name)   RST_LOG_SCOPE_TIME(nullptr, name)
 Same as RST_LOG_SCOPE_TIME(), on the default logger.
 
#define RST_LOG_SCOPE_TIME_WARN(logger, name, thresholdMs)
 Same as RST_LOG_SCOPE_TIME(), logging a warning from thresholdMs milliseconds.
 

Macro Definition Documentation

◆ RST_LOG_SCOPE_TIME

#define RST_LOG_SCOPE_TIME (   logger,
  name 
)
Value:
::RST::Log::ScopedTimer RST_LOG_CONCAT(rstScopedTimer, __LINE__)(name, logger, \
::RST::Log::ScopedTimer::Duration(-1), ::RST::Log::LogLevel::Debug, RST_SOURCE_LOCATION)
#define RST_SOURCE_LOCATION
SourceLocation of the line where it is written.
Definition SourceLocation.hpp:17
Logs the time spent in a scope when destroyed, usually through RST_LOG_SCOPE_TIME().
Definition ScopedTimer.hpp:16

Times the rest of the current scope and logs it at debug level on logger.

◆ RST_LOG_SCOPE_TIME_DEFAULT

#define RST_LOG_SCOPE_TIME_DEFAULT (   name)    RST_LOG_SCOPE_TIME(nullptr, name)

Same as RST_LOG_SCOPE_TIME(), on the default logger.

◆ RST_LOG_SCOPE_TIME_WARN

#define RST_LOG_SCOPE_TIME_WARN (   logger,
  name,
  thresholdMs 
)
Value:
::RST::Log::ScopedTimer RST_LOG_CONCAT(rstScopedTimer, __LINE__)(name, logger, \
std::chrono::milliseconds(thresholdMs), ::RST::Log::LogLevel::Debug, RST_SOURCE_LOCATION)

Same as RST_LOG_SCOPE_TIME(), logging a warning from thresholdMs milliseconds.