DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
LoggerBase.h
Go to the documentation of this file.
1#pragma once
2#include "Common.h"
5
6
7namespace DotNetDupe {
8 namespace Extensions {
9 namespace Logging {
10
16 class LoggerBase : public ILogger {
17 protected:
20
23
26
28 const char* LogLevelToString(LogLevel level) const;
29
33
34 public:
39
41 DOTNETDUPE_API ~LoggerBase() override = default;
42
46 DOTNETDUPE_API bool IsEnabled(LogLevel logLevel) const override;
47
51 DOTNETDUPE_API void Log(LogLevel logLevel, const DotNetDupe::System::String& message) override;
52
57 DOTNETDUPE_API void Log(LogLevel logLevel, const DotNetDupe::System::String& message,
59 };
60
61 }
62 }
63}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Represents a type used to perform logging.
Definition ILogger.h:36
DotNetDupe::System::String m_categoryName
Definition LoggerBase.h:18
DotNetDupe::System::String FormatLogLine(const DotNetDupe::System::String &fmt, const DotNetDupe::System::String &timestamp, const DotNetDupe::System::String &level, const DotNetDupe::System::String &category, const DotNetDupe::System::String &message, const DotNetDupe::System::String &properties, const DotNetDupe::System::String &processId, const DotNetDupe::System::String &threadId) const
Formats a single log line according to configuration template.
void Log(LogLevel logLevel, const DotNetDupe::System::String &message) override
Writes a log entry without extra structured properties.
const char * LogLevelToString(LogLevel level) const
Converts a LogLevel enumeration to its uppercase string name.
bool IsEnabled(LogLevel logLevel) const override
Checks whether logging is enabled for the specified log level.
DotNetDupe::System::String GetFormattedTimestamp(const DotNetDupe::System::String &formatFmt) const
Generates a formatted timestamp string using strftime syntax.
void Log(LogLevel logLevel, const DotNetDupe::System::String &message, const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > &properties) override=0
Writes a log entry with extra structured properties.
DotNetDupe::System::String BuildLogMessage(LogLevel logLevel, const DotNetDupe::System::String &message, const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > &properties) const
Builds the final log message string applying plain text or JSON serialization.
~LoggerBase() override=default
Virtual destructor for polymorphic cleanup.
LoggerBase(const DotNetDupe::System::String &categoryName, const LoggerConfiguration &config)
Initializes a new LoggerBase instance with category name and configuration.
Represents a collection of keys and values.
Definition Dictionary.h:66
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
LogLevel
Defines logging severity levels.
Definition ILogger.h:15
Encapsulates logging system configuration options.