DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
ILogger.h
Go to the documentation of this file.
1#pragma once
2#include "Common.h"
3#include "System/Object.h"
4#include "System/String.h"
7
8namespace DotNetDupe {
9 namespace Extensions {
10 namespace Logging {
11
15 enum class LogLevel {
17 Trace = 0,
19 Debug = 1,
25 Error = 4,
29 None = 6
30 };
31
36 class ILogger : public virtual DotNetDupe::System::Object {
37 public:
39 virtual ~ILogger() = default;
40
44 virtual void Log(LogLevel logLevel, const DotNetDupe::System::String& message) = 0;
45
50 virtual void Log(LogLevel logLevel, const DotNetDupe::System::String& message,
52
56 virtual bool IsEnabled(LogLevel logLevel) const = 0;
57 };
58
62 template <typename T>
63 class ILoggerOf : public virtual ILogger {
64 public:
66 virtual ~ILoggerOf() = default;
67 };
68
73 public:
75 virtual ~ILoggerProvider() = default;
76
81 };
82
87 public:
89 virtual ~ILoggerFactory() = default;
90
94
99 };
100
101 }
102 }
103}
Defines common cross-platform macros, export decorators, and fundamental types.
Base object class for DotNetDupe mirroring .NET System.Object.
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Represents a type used to configure the logging system and create instances of ILogger.
Definition ILogger.h:86
virtual void AddProvider(const DotNetDupe::System::SmartPointer< ILoggerProvider > &provider)=0
Adds an ILoggerProvider to the logging system.
virtual DotNetDupe::System::SmartPointer< ILogger > CreateLogger(const DotNetDupe::System::String &categoryName)=0
Creates a new ILogger instance for the specified category.
virtual ~ILoggerFactory()=default
Virtual destructor for polymorphic cleanup.
Represents a type used to perform logging.
Definition ILogger.h:36
virtual void Log(LogLevel logLevel, const DotNetDupe::System::String &message)=0
Writes a log entry at the specified log level.
virtual bool IsEnabled(LogLevel logLevel) const =0
Checks if the given logLevel is enabled.
virtual void Log(LogLevel logLevel, const DotNetDupe::System::String &message, const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > &properties)=0
Writes a structured log entry with key-value property metadata.
virtual ~ILogger()=default
Virtual destructor for polymorphic cleanup.
A generic interface for logging where the category name is derived from the specified type name.
Definition ILogger.h:63
virtual ~ILoggerOf()=default
Virtual destructor for polymorphic cleanup.
Represents a type that can create instances of ILogger.
Definition ILogger.h:72
virtual DotNetDupe::System::SmartPointer< ILogger > CreateLogger(const DotNetDupe::System::String &categoryName)=0
Creates a new ILogger instance for the specified category.
virtual ~ILoggerProvider()=default
Virtual destructor for polymorphic cleanup.
Represents a collection of keys and values.
Definition Dictionary.h:66
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
A unified smart pointer that supports both unique and shared ownership semantics.
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
@ Warning
Logs that highlight an abnormal or unexpected event.
Definition ILogger.h:23
@ Critical
Logs that describe an unrecoverable application or system crash.
Definition ILogger.h:27
@ None
Not used for writing log messages. Specifies that a logging category should not write any messages.
Definition ILogger.h:29
@ Error
Logs that highlight when the current flow of execution is stopped due to a failure.
Definition ILogger.h:25
@ Debug
Logs that are used for interactive investigation during development.
Definition ILogger.h:19
@ Information
Logs that track the general flow of the application.
Definition ILogger.h:21
@ Trace
Logs that contain the most detailed messages.
Definition ILogger.h:17