Lagrange

Functions related to logging. More...

Classes

class  ScopedLogLevel
 Changes the level of logger to something else in a scope. More...
 

Functions

LA_CORE_API spdlog::logger & logger ()
 Retrieves the current logger. More...
 
LA_CORE_API void set_logger (std::shared_ptr< spdlog::logger > logger)
 Setup a logger object to be used by Lagrange. More...
 

Detailed Description

Functions related to logging.

To use the logger in your application, simply include this header, and call

#include <lagrange/Logger.h>
lagrange::logger().info("This is a message");
lagrange::logger().warning("Invalid value for x: {}", x);
// set logger verbosity
lagrange::logger().set_level(spdlog::level::debug);
LA_CORE_API spdlog::logger & logger()
Retrieves the current logger.
Definition: Logger.cpp:40

The Lagrange logger is a plain spdlog logger, with a type-safe printf formatting syntax provided by fmt. For more details, please consult these libraries' respective documentations:

Function Documentation

◆ logger()

logger ( )

#include <lagrange/Logger.h>

Retrieves the current logger.

Returns
A const reference to Lagrange's logger object.

◆ set_logger()

void set_logger ( std::shared_ptr< spdlog::logger >  logger)

#include <lagrange/Logger.h>

Setup a logger object to be used by Lagrange.

Calling this function with other Lagrange function is not thread-safe.

Parameters
[in]loggerNew logger object to be used by Lagrange. Ownership is shared with Lagrange.