# ScopeLogger.h File Reference

Contains the definition of ScopeLogger class and related macros. More...

`#include "LogLevel.h"`
`#include "CompositeLoggable.h"`
`#include "ChainLoggable.h"`
`#include "FormattedChainLoggable.h"`
`#include "Logger.h"`
`#include "TStd.h"`

Go to the source code of this file.

## Classes
class | ScopeLogger
| Helper class for the user of the logging system. Allows to define the hierarchy of the project. More...
## Defines
#define | DEFINE_LOGGER(name)
| Makes a ScopeLogger with this name available to use in enclosing class or function.
#define | LOG(logLevel, message)
| Logs the passed message into the logging system via ScopeLogger defined in this class or function.
#define | LOGF(logLevel, format, message)
| Variation of LOG() macro allowing to specify custom formatting for the message.

## Detailed Description

Contains the definition of ScopeLogger class and related macros.

Author:
  Bartosz Janiak

Copyright © 2009 NVIDIA Corporation. All rights reserved.

NVIDIA Corporation and its licensors retain all intellectual property and proprietary rights in and to this software, related documentation and any modifications thereto. Any use, reproduction, disclosure or distribution of this software and related documentation without express license agreement from NVIDIA Corporation is strictly prohibited.

Definition in file ScopeLogger.h.

## Define Documentation

#define DEFINE_LOGGER | ( | name |  | ) |

Value:

    class _ScopeLoggerWrapper {                                             \
    public:                                                                 \
        static Nvidia::Logging::ScopeLogger& GetScopeLogger()               \
        {                                                                   \
            static Nvidia::Logging::ScopeLogger scopeLogger((name));        \
            return scopeLogger;                                             \
        }                                                                   \
    }

Makes a ScopeLogger with this name available to use in enclosing class or function.

Definition at line 27 of file ScopeLogger.h.

#define LOG | ( | logLevel,
|  | message |  | ) |

Value:

    {                                                                                      \
        using namespace Nvidia::Logging;                                                   \
        if ( !_ScopeLoggerWrapper::GetScopeLogger().IsFiltered((LogLevel_ ## logLevel)) )  \
        {                                                                                  \
                _ScopeLoggerWrapper::GetScopeLogger().Log((LogLevel_ ## logLevel),         \
                MakeChainLoggable(MakeEmptyChain() + message),                             \
                _T(__FUNCTION__), __LINE__, _T(__FILE__));                                 \
        }                                                                                  \
    }

Logs the passed message into the logging system via ScopeLogger defined in this class or function.

Parameters:

  | logLevel | LogLevel at which to log the message.
  | message | List of loggable elements separated by "+" operator, or a single loggable element. "Loggable elements" in this context are understood as: objects inheriting from Loggable abstract class, built-in C++ types, anything else which can be outputted to an ofstream, a vector of any of the above.

Definition at line 49 of file ScopeLogger.h.

#define LOGF | ( | logLevel,
|  | format,
|  | message |  | ) |

Value:

    {                                                                                      \
        using namespace Nvidia::Logging;                                                   \
        if ( !_ScopeLoggerWrapper::GetScopeLogger().IsFiltered((LogLevel_ ## logLevel)) )  \
        {                                                                                  \
            _ScopeLoggerWrapper::GetScopeLogger().Log((LogLevel_ ## logLevel),             \
                MakeFormattedChainLoggable(MakeEmptyChain() + message, format),            \
                _T(__FUNCTION__), __LINE__, _T(__FILE__));                                 \
        }                                                                                  \
    }

Variation of LOG() macro allowing to specify custom formatting for the message.

Parameters:

  | logLevel | LogLevel at which to log the message.
  | format | Format string conforming to the boost::format specification (which is compatible with printf format specification, see http://www.boost.org/doc/libs/1_39_0/libs/format/doc/format.html#printf_directives for details).
  | message | List of loggable elements separated by "+" operator, or a single loggable element. "Loggable elements" in this context are understood as: objects inheriting from Loggable abstract class, built-in C++ types, anything else which can be outputted to an ofstream, a vector of any of the above.

Definition at line 75 of file ScopeLogger.h.