carb/logging/StandardLogger2.h

File members: carb/logging/StandardLogger2.h

// Copyright (c) 2023-2024, 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 an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//

#pragma once

#include "LoggingTypes.h"
#include "ILogging.h"

namespace carb
{
namespace logging
{

struct Logger;
struct StandardLogger;

#if CARB_VERSION_ATLEAST(carb_logging_ILogging, 1, 2)

using LogDestinations = uint32_t;

constexpr LogDestinations fLogDestinationNone = 0x00;

constexpr LogDestinations fLogDestinationStandardStreams = 0x01;

constexpr LogDestinations fLogDestinationLogFile = 0x02;

constexpr LogDestinations fLogDestinationDebugConsole = 0x04;
#endif

#if CARB_VERSION_ATLEAST(carb_logging_ILogging, 1, 1)

class StandardLogger2
{
    // This class's ABI is versioned by the ILogging version.
public:
    virtual void addRef() = 0;

    virtual void release() = 0;

    virtual Logger* getLogger() = 0;

    virtual void setFilenameIncluded(bool included) = 0;

    virtual void setLineNumberIncluded(bool included) = 0;

    virtual void setFunctionNameIncluded(bool included) = 0;

    virtual void setTimestampIncluded(bool included) = 0;

    virtual void setThreadIdIncluded(bool included) = 0;

    virtual void setSourceIncluded(bool included) = 0;

    virtual void setStandardStreamOutput(bool enabled) = 0;

    virtual void setDebugConsoleOutput(bool enabled) = 0;

    virtual void setFileOutput(const char* filePath) = 0;

    virtual void setFileOuputFlushLevel(int32_t level) = 0;

    virtual void setFlushStandardStreamOutput(bool enabled) = 0;

    virtual void setElapsedTimeUnits(const char* units) = 0;

    virtual void setProcessIdIncluded(bool enabled) = 0;

    virtual void setMultiProcessGroupId(int32_t id) = 0;

    virtual void setColorOutputIncluded(bool enabled) = 0;

    virtual void setOutputStream(OutputStream outputStream) = 0;

    virtual void setStandardStreamOutputLevelThreshold(int32_t level) = 0;

    virtual void setDebugConsoleOutputLevelThreshold(int32_t level) = 0;

    virtual void setFileOutputLevelThreshold(int32_t level) = 0;

    virtual void setFileConfiguration(const char* filePath, const LogFileConfiguration* config) = 0;

    virtual size_t getFileConfiguration(char* buffer, size_t bufferSize, LogFileConfiguration* config) = 0;

    virtual void pauseFileLogging() = 0;

    virtual void resumeFileLogging() = 0;

    virtual void setForceAnsiColor(bool forceAnsiColor) = 0;

    virtual void setLevelThresholdThreadOverride(OutputType type, int32_t level) = 0;

    virtual void clearLevelThresholdThreadOverride(OutputType type) = 0;

#    if CARB_VERSION_ATLEAST(carb_logging_ILogging, 1, 2)
    virtual LogDestinations getConfiguredLogDestinationsForLevel(int32_t level) = 0;
#    endif
    // Functions may be added to this class as long as it is not inherited from (as an interface) and ILogging's minor
    // version is incremented.
};

#endif

} // namespace logging
} // namespace carb