LogChannel.h#
Fully qualified name: omni/log/LogChannel.h
File members: omni/log/LogChannel.h
// SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once
#include <cstdint>
#include <vector>
#define OMNI_LOG_DECLARE_CHANNEL(varName_) extern omni::log::LogChannelData varName_;
#define OMNI_LOG_ADD_CHANNEL(varName_, channelName_, description_) \
OMNI_LOG_DEFINE_CHANNEL_(varName_, channelName_, description_, true)
#define OMNI_LOG_DEFINE_CHANNEL(varName_, channelName_, description_) \
OMNI_LOG_DEFINE_CHANNEL_(varName_, channelName_, description_, false)
#define OMNI_LOG_DEFINE_CHANNEL_(varName_, channelName_, description_, add_) \
omni::log::LogChannelData varName_{ channelName_, 0, description_, nullptr }; \
omni::log::LogChannelRegistrar varName_##Registrar{ &varName_, add_ };
#ifndef OMNI_LOG_DEFAULT_CHANNEL
# define OMNI_LOG_DEFAULT_CHANNEL kDefaultChannel
#endif
namespace omni
{
namespace log
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
struct LogChannelData
{
const char* const name;
int32_t level;
const char* const description;
LogChannelData* next;
};
#endif
inline LogChannelData*& getModuleLogChannels() noexcept
{
static LogChannelData* sHead = nullptr;
return sHead;
}
inline bool& hasModuleLogChannelsRegistered() noexcept
{
static bool sRegistered = false;
return sRegistered;
}
} // namespace log
} // namespace omni
#ifndef DOXYGEN_SHOULD_SKIP_THIS
# define OMNI_LOG_DECLARE_DEFAULT_CHANNEL_1(chan_) OMNI_LOG_DECLARE_CHANNEL(chan_)
# define OMNI_LOG_DECLARE_DEFAULT_CHANNEL() OMNI_LOG_DECLARE_DEFAULT_CHANNEL_1(OMNI_LOG_DEFAULT_CHANNEL)
// forward declare the default channel
OMNI_LOG_DECLARE_DEFAULT_CHANNEL()
#endif