• NeonSDK
  • NeonKUBE
Search Results for

    Show / Hide Table of Contents
    • Neon
      • Build
    • Neon.Blazor
      • BlazorHelper
      • BodyOutlet
      • ClientRenderContext
      • DOMRectReadOnly
      • EventHandlers
      • FileDownloader
      • HtmlElement
      • IRenderContext
      • IntersectionChangedEventArgs
      • IntersectionObserver
      • IntersectionObserverContext
      • MobileDetector
      • NeonBlazorExtensions
      • ServerRenderContext
      • SwipeDirection
      • SwipeHandler
    • Neon.Blazor.Analyzers
      • SvgGenerator
      • SvgGenerator.Svg
    • Neon.BuildInfo
      • ThisAssembly
      • ThisAssembly.Git
      • ThisAssembly.Git.BaseVersion
      • ThisAssembly.Git.SemVer
    • Neon.CSharp
      • CSharpHelper
      • CompilerErrorException
      • MetadataReferences
    • Neon.Cassandra
      • KeyspaceStatus
      • RowSetExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
      • SessionExtensions
    • Neon.Collections
      • ArgDictionary
      • Bits
      • IObjectDictionary
      • NiceDictionary<TKey, TValue>
      • ObjectDictionary
    • Neon.Common
      • AppDomainExtensions
      • Block
      • BlockArray
      • ByteEncoding
      • ByteUnits
      • CommandLine
      • CommandLine.OptionDefinition
      • CommandLine.Redactor
      • CpuArchitecture
      • Credentials
      • DateTimeExtensions
      • EnumExtensions
      • EnvironmentParser
      • EnvironmentParser.Parser<T>
      • EnvironmentParser.Validator<T>
      • EnvironmentParser.VariableSource
      • ExceptionExtensions
      • ExecuteException
      • ExecuteResponse
      • GlobPattern
      • HexDumpOption
      • HttpClientExtensions
      • HttpResponseMessageExtensions
      • IEnumerableExtensions
      • ILabeled
      • IOExtensions
      • IServiceContainer
      • IStaticDirectoryExtensions
      • LabelSelector
      • LabelSelectorOptions
      • LabelSelector<TItem>
      • NeonAssemblyExtensions
      • NeonExtendedHelper
      • NeonHelper
      • NetFramework
      • NewtonsoftExtensions
      • NotReadyException
      • ProcessExtensions
      • ProgramEntrypoint
      • ProgramEntrypointAsync
      • ProgramExitException
      • ProgramRunner
      • RandomExtensions
      • ReflectionExtensions
      • SemanticVersion
      • ServiceContainer
      • StaticZipOptions
      • StringBuilderExtensions
      • StringExtensions
      • Stub
      • Stub.Value
      • TaskExtensions
      • TimeSpanExtensions
      • ToolException
      • TriState
      • WeakEventController
      • WindowsEdition
      • WindowsFeatureStatus
      • YamlDotNetExtensions
    • Neon.Cryptography
      • AesCipher
      • CryptoExtensions
      • CryptoHelper
      • NeonVault
      • Wildcard
    • Neon.Csv
      • CsvReader
      • CsvTableReader
      • CsvTableWriter
      • CsvWriter
    • Neon.Data
      • DateTimeJsonConverter
      • DateTimeOffsetJsonConverter
      • IEnhancedJsonConverter
      • IGeneratedServiceClient
      • IPersistableType
      • IPersistableType<T>
      • IRoundtripData
      • IntegerEnumConverter<TEnum>
      • NotifyPropertyChanged
      • RoundtripDataFactory
      • RoundtripDataHelper
      • TimeSpanJsonConverter
      • VersionJsonConverter
    • Neon.Deployment
      • AwsCli
      • DeploymentException
      • DeploymentHelper
      • DownloadManifest
      • DownloadPart
      • DownloadProgressDelegate
      • DownloadProgressType
      • GitHub
      • GitHubActionsApi
      • GitHubPackage
      • GitHubPackageApi
      • GitHubPackageType
      • GitHubPackageVersion
      • GitHubPackageVisibility
      • GitHubReleaseApi
      • GitHubRepoPath
      • GitHubTagApi
      • IProfileClient
      • IProfileRequest
      • IProfileResponse
      • MaintainerProfile
      • NotifyClient
      • OnePassword
      • OnePasswordException
      • ProfileException
      • ProfileHandlerResult
      • ProfileRequest
      • ProfileResponse
      • ProfileServer
      • ProfileStatus
      • XenServer
    • Neon.Deployment.CodeSigning
      • AzureProfile
      • CodeSigner
      • UsbTokenProfile
    • Neon.Diagnostics
      • AssertException
      • ConfigExtensions
      • ConsoleJsonLogExporter
      • ConsoleJsonLogExporterOptions
      • ConsoleTextLogExporter
      • ConsoleTextLogExporterOptions
      • ExceptionInfo
      • FileLogExporter
      • FileLogExporterFormat
      • FileLogExporterOptions
      • LogAsTraceProcessor
      • LogAsTraceProcessorOptions
      • LogAttributeNames
      • LogAttributes
      • LogEvent
      • LogEventInterceptor
      • LoggerExtensions
      • NullLogger
      • TelemetryHub
      • TelemetrySpanEventNames
      • TelemetrySpanExtensions
    • Neon.Docker
      • DockerClient
      • DockerNetwork
      • DockerNetworkContainer
      • DockerNetworkIpam
      • DockerNode
      • DockerNodeManagerStatus
      • DockerResponse
      • DockerSettings
      • DockerVolume
      • NetworkCreateResponse
      • ServiceBindOptions
      • ServiceConfig
      • ServiceContainerSpec
      • ServiceCredentialSpec
      • ServiceDetails
      • ServiceDiscreteResourceSpec
      • ServiceDnsConfig
      • ServiceEndpoint
      • ServiceEndpointMode
      • ServiceEndpointPortConfig
      • ServiceEndpointSpec
      • ServiceFile
      • ServiceGenericResources
      • ServiceGlobalSchedulingMode
      • ServiceHealthCheck
      • ServiceIsolationMode
      • ServiceListResponse
      • ServiceLogDriver
      • ServiceMode
      • ServiceMount
      • ServiceMountBindPropagation
      • ServiceMountConsistency
      • ServiceMountType
      • ServiceNamedResourceSpec
      • ServiceNetwork
      • ServicePlacement
      • ServicePlacementPreferences
      • ServicePlacementSpreadSettings
      • ServicePlatform
      • ServicePortMode
      • ServicePortProtocol
      • ServicePrivileges
      • ServiceReplicatedSchedulingMode
      • ServiceResourceSettings
      • ServiceResources
      • ServiceRestartCondition
      • ServiceRestartPolicy
      • ServiceRollbackConfig
      • ServiceRollbackFailureAction
      • ServiceRollbackOrder
      • ServiceSELinuxContext
      • ServiceSchedulingMode
      • ServiceSecret
      • ServiceSpec
      • ServiceTaskTemplate
      • ServiceTmpfsOptions
      • ServiceUpdateConfig
      • ServiceUpdateFailureAction
      • ServiceUpdateOrder
      • ServiceUpdateState
      • ServiceUpdateStatus
      • ServiceVersion
      • ServiceVirtualIP
      • ServiceVolumeDriverConfig
      • ServiceVolumeOptions
      • VolumeListResponse
    • Neon.GitHub
      • GitExtensions
      • GitHubCredentials
      • GitHubRepo
      • LocalRepoApi
      • NoLocalRepositoryException
      • RemoteRepoApi
      • RemoteRepoBranchApi
      • RemoteRepoIssueApi
      • RemoteRepoIssueCommentApi
      • RemoteRepoPath
      • RemoteRepoReleaseApi
      • RemoteRepoTagApi
    • Neon.HyperV
      • HyperVClient
      • HyperVDriverType
      • HyperVException
      • NetAdapter
      • VirtualDrive
      • VirtualIPAddress
      • VirtualMachine
      • VirtualMachineNetworkAdapter
      • VirtualMachineState
      • VirtualNat
      • VirtualSwitch
      • VirtualSwitchType
    • Neon.IO
      • BlockStream
      • FixedLengthStream
      • IStaticDirectory
      • IStaticFile
      • LineEnding
      • LinuxPath
      • LinuxPermissions
      • PreprocessReader
      • RelayStream
      • StaticDirectoryBase
      • StaticFileBase
      • SubStream
      • TempFile
      • TempFolder
    • Neon.JsonConverters
      • JsonDateTimeConverter
      • JsonGenericConverter<T>
      • JsonNullableDateTimeConverter
    • Neon.ModelGen
      • ActionResult<T>
      • ApiVersion
      • ApiVersionAttribute
      • BodyStreamAttribute
      • ControllerValidationAttribute
      • DataModelAttribute
      • EnumMember
      • FromBodyAttribute
      • FromHeaderAttribute
      • FromQueryAttribute
      • FromRouteAttribute
      • GeneratedClientAttribute
      • GeneratedMethodAttribute
      • GeneratedParamAttribute
      • HashSourceAttribute
      • HttpAttribute
      • HttpDeleteAttribute
      • HttpGetAttribute
      • HttpHeadAttribute
      • HttpOptionsAttribute
      • HttpPatchAttribute
      • HttpPostAttribute
      • HttpPutAttribute
      • IActionResult
      • ModelGenerator
      • ModelGeneratorOutput
      • ModelGeneratorSettings
      • NoCodeGenAttribute
      • NoControllerValidationAttribute
      • PassAs
      • PersistableAttribute
      • PersistableKeyAttribute
      • RouteAttribute
      • ServiceModelAttribute
      • TargetAttribute
      • UxFrameworks
    • Neon.Net
      • HttpApiException
      • HttpException
      • JsonClient
      • JsonClientPayload
      • JsonResponse
      • Jwt
      • LocalHostSection
      • NetConst
      • NetHelper
      • NetworkCidr
      • NetworkConfiguration
      • NetworkException
      • NetworkPorts
      • Pinger
      • ReachableHost
      • ReachableHostMode
      • StreamDocument
    • Neon.Postgres
      • ConnectionExtensions
      • DatabaseStatus
      • PreparedCommand
      • ReaderAsyncEnumerator
      • ReaderEnumerator
      • ReaderExtensions
      • SchemaManager
      • SchemaManagerException
      • SchemaStatus
    • Neon.Retry
      • ExponentialRetryPolicy
      • IRetryPolicy
      • LinearRetryPolicy
      • NoRetryPolicy
      • RetryPolicy
      • RetryPolicyBase
      • RetryTransientArgs
      • TransientDetector
      • TransientException
    • Neon.Roslyn
      • DisplayFormat
      • DocumentationComment
      • DocumentationItem
      • MetadataLoadContext
      • RoslynAssembly
      • RoslynConstructorInfo
      • RoslynCustomAttributeData
      • RoslynExtensions
      • RoslynFieldInfo
      • RoslynMethodInfo
      • RoslynParameterInfo
      • RoslynPropertyInfo
      • RoslynType
      • SharedUtilities
    • Neon.Roslyn.Xunit
      • AdditionalSourceText
      • CompilationOptions
      • CompilationOptionsProvider
      • TestCompilation
      • TestCompilationAssertions
      • TestCompilationBuilder
      • TestCompilationBuilderExtensions
      • TestCompilationExtensions
    • Neon.SSH
      • CommandBundle
      • CommandFile
      • CommandResponse
      • HostFolders
      • IBashCommandFormatter
      • ILinuxSshProxy
      • LinuxDiskInfo
      • LinuxDiskPartition
      • LinuxSshProxy
      • LinuxSshProxy<TMetadata>
      • NamespaceDoc
      • RemoteCommandException
      • RunOptions
      • SshCredentials
      • SshExtensions
      • SshProxyException
    • Neon.Service
      • LogMetricsProcessor
      • MetricsMode
      • MetricsOptions
      • NeonService
      • NeonServiceOptions
      • NeonServiceStatus
      • OtelConfigExtensions
      • OtlpCollectorChecker
      • ProcessTerminator
      • ServiceApiContact
      • ServiceApiInfo
      • ServiceApiLicense
      • ServiceDependencies
      • ServiceDescription
      • ServiceEndpoint
      • ServiceEndpointProtocol
      • ServiceEndpoints
      • ServiceMap
    • Neon.SignalR
      • DependencyInjectionExtensions
      • DnsCache
      • GroupAction
      • GroupCommand
      • IDnsCache
      • Invocation
      • NatsHubLifetimeManager<THub>
      • ProxyConfig
      • ServiceCollectionExtensions
      • ServiceDiscovey
      • SignalrProxyMiddleware
      • SignalrProxyMiddlewareExtensions
      • TracerProviderBuilderExtensions
    • Neon.Tailwind
      • ClickOffEventHandler
      • ComponentEventArgs<TSender>
      • ComponentEventArgs<TSender, TEventArgs>
      • DisclosureState
      • EventHandlerComponentBase<TComponent>
      • HeadlessButton
      • HeadlessDialog
      • HeadlessDialogPanel
      • HeadlessDisclosure
      • HeadlessDisclosureButton
      • HeadlessDisclosurePanel
      • HeadlessListboxButton<TValue>
      • HeadlessListboxLabel<TValue>
      • HeadlessListboxOption<TValue>
      • HeadlessListboxOptions<TValue>
      • HeadlessListbox<TValue>
      • HeadlessMenu
      • HeadlessMenuButton
      • HeadlessMenuItem
      • HeadlessMenuItems
      • HeadlessSwitch
      • HeadlessSwitchGroup
      • HeadlessSwitchLabel
      • IPortalBinder
      • KeyDownEventHandler
      • KeyboardKey
      • ListboxFocus
      • ListboxState
      • MenuFocus
      • MenuState
      • Portal
      • PortalBinder
      • PortalContent
      • SearchAssistant
      • TailwindExtensions
      • Transition
      • TransitionGroup
      • TransitionState
    • Neon.Tasks
      • Async
      • AsyncAutoResetEvent
      • AsyncManualResetEvent
      • AsyncMutex
      • AsyncPeriodicTask
      • AsyncReaderWriterLock
      • AsyncReentrantMutex
      • AsyncTimer
      • IAsyncFuture
      • IAsyncFuture<T>
      • NonDisposableTask
      • NonDisposableTask<T>
      • SyncContext
      • SyncContextMode
    • Neon.Temporal
      • ActivityHelper
      • ActivityLogEnricher
      • TemporalEnricherTagNames
      • WorkflowLogEnricher
    • Neon.Time
      • GatedTimer
      • GoDuration
      • PolledTimer
      • RecurringTimer
      • RecurringTimerType
      • SysTime
      • TimeOfDay
    • Neon.WSL
      • Wsl2Proxy
    • Neon.Web
      • AesProtector
      • DataProtectionExtensions
      • NeonController
      • NeonControllerBase
      • RoundTripJsonInputFormatter
      • RoundTripJsonOutputFormatter
      • TracerProviderBuilderExtensions
      • WebHelper
    • Neon.WinTTY
      • ConsoleTTY
    • Neon.Windows
      • MEMORYSTATUSEX
      • PowerShellException
      • Win32
    • Neon.XenServer
      • IXenClient
      • XenClient
      • XenClient.MachineOperations
      • XenClient.StorageOperations
      • XenClient.TemplateOperations
      • XenException
      • XenHostInfo
      • XenObject
      • XenResponse
      • XenStorageRepository
      • XenTempIso
      • XenTemplate
      • XenVirtualDisk
      • XenVirtualMachine
      • XenVmPowerState
    • Neon.Xunit
      • AnsiblePlayResults
      • AnsiblePlayer
      • AnsibleTaskResult
      • AspNetFixture
      • BasicFixture
      • CodeFixture
      • CollectionComparer<T>
      • ComposedFixture
      • ContainerFixture
      • ContainerLimits
      • DockerComposeFixture
      • DockerFixture
      • DockerFixture.ConfigInfo
      • DockerFixture.ContainerInfo
      • DockerFixture.NetworkInfo
      • DockerFixture.SecretInfo
      • DockerFixture.ServiceInfo
      • DockerFixture.StackDefinition
      • DockerFixture.StackInfo
      • DockerFixture.StackService
      • EnvironmentFixture
      • HostsFixture
      • ITestFixture
      • IncompatibleServiceException
      • MaintainerFactAttribute
      • MaintainerTheoryAttribute
      • MockHttpServer
      • MockHttpServerExtensions
      • NatsFixture
      • NatsStreamingFixture
      • NeonServiceFixture<TService>
      • PlatformFactAttribute
      • RepeatAttribute
      • TargetPlatforms
      • TestArea
      • TestCollection
      • TestContext
      • TestFixture
      • TestFixtureStatus
      • TestHelper
      • TestHttpClient
      • TestOutputWriter
      • TestTrait
      • XunitExtensions
    • Neon.Xunit.YugaByte
      • YugaByteFixture
    • Neon.YugaByte
      • YugaByteHelper

    Class LoggerExtensions

    Extends ILogger with additional handy logging methods. We recommend that users standardize on calling these logger extensions as opposed to using Microsoft's standard Microsoft.Extensions.Logging.LoggerExtensions.

    Inheritance
    object
    LoggerExtensions
    Namespace: Neon.Diagnostics
    Assembly: Neon.Common.dll
    Syntax
    public static class LoggerExtensions
    Remarks

    EVENT LOGGING:

    This class extends ILogger with methods intended to be somewhat easier to use than Microsoft's extensions. Our logging method names end with "Ex" and we provide methods for logging critical, error, warning, information, debug and trace events. We have overrides for each log level that can be used for different purposes. We'll discuss the information methods below. The methods for the other log levels folow the same pattern.

    The first thing to note, is that all logging methods include an optional attributeSetter parameter. This can be set to an Action that adds arbitrary tags to the event when logged. This is an easy and clean way to specify attributes, much cleaner than specifying a message format string as required by the Microsoft.Extensions.Logging.LoggerExtensions (e.g. there's no way to include an attribute without having it appear in the event message). Here's how this works:

    logger.LogInformationEx("Test message",
        attributes => {
            attributes.Add("my-attr-0", "test-0");
            attributes.Add("my-attr-1", "test-1");
        });
    note

    The attributes lambda function is only called when the event is actually going to be logged, based on the current log level.

    Some of our extensions accept the message as a string and others accept a lambda function that returns the message string. The general rule is that you should pass constant strings directly to the logging methods but strings generated at runtime via interpolation or other mechanisms should be specified by passing a message lambda function.

    note

    The message lambda function is only called when the event is actually going to be logged, based on the current log level.

    The latter recomendation will improve performance because the lambda function won't be called when the event won't actually be logged due to the current log level, avoiding the overhead of generating the string. Imagine if your program logged a lot of TRACE events with dynamically generated messages. This means that when running at the INFORMATION log level, all of those trace messages would be created at runtime and then be immediately discarded, resulting in wasted CPU used to generate the message as well as extra heap allocations (all for nothing).

    // Log a static message:
    

    logger.LogInformationEx("Hello World!");

    // Log a dynamic message:

    var name = "Sally";

    logger.LogInformation(() => $"Hello: {name}");

    // YOU DON'T WANT TO DO THIS because the message string will always be generated at runtime, // even when the event won't be logged due to the current log level:

    logger.LogInformation($"Hello: {name}");

    LogInformationEx(ILogger, string, Action<LogAttributes>): Used for logging a constant message string. Avoid calling this for dynamically generated messages.

    LogInformationEx(ILogger, Func<string>, Action<LogAttributes>): Used for logging a dynamically generated message. This will be much more efficient when the event isn't going to be logged due to the current log level setting.

    LogInformationEx(ILogger, Exception, string, Action<LogAttributes>): Used for logging an exception with a constant or null message. When message is passed as empty or null, a message generated from exception will be used.

    LogInformationEx(ILogger, Exception, Func<string>, Action<LogAttributes>): Used for logging an exception with a dynamic message. When the message function is passed null, a message generated from exception will be used.

    LOGGER ATTRIBUTES

    Use the AddAttributes(ILogger, Action<LogAttributes>) method to create a new ILogger with new attributes such that these attributes will be included in subsequent events emitted by the logger. Note that attributes logged with the event will override logger attributes with the same name.

    Here's how this works:

    var logger     = TelemetryHub.CreateLogger("my-logger");
    var attributes = new LogAttributes();
    

    attributes.Add("my-attr-0", "test-0"); attributes.Add("my-attr-1", "test-1");

    logger = logger.AddAttributes(attributes); // Creates a new logger including the attributes passed.

    logger.LogInformationEx("Test message"); // This event will include the new attributes

    // This example overrides the logger's "test-1" attribute with the "OVERRIDE" value:

    logger.LogInformationEx("Test message", attributes => attributes.Add("test-1", "OVERRIDE"));

    note

    IMPORTANT: Any additional attributes added to the logger returned will only be recognized by the neondSDK logger extensions LoggerExtensions with logging method names ending in "Ex", like: LogInformationEx(ILogger, Func<string>, Action<LogAttributes>). The standard Microsoft logger extension methods implemented by Microsoft.Extensions.Logging.LoggerExtensions will ignore these logger attributes.

    Methods

    AddAttributes(ILogger, Action<LogAttributes>)

    This wraps the logger passed with another logger that adds a colection of attributes to every logged event.

    note

    IMPORTANT: Any additional attributes added to the logger returned will only be recognized by the neondSDK logger extensions LoggerExtensions with logging method names ending in "Ex", like: LogInformationEx(ILogger, Func<string>, Action<LogAttributes>). The standard Microsoft logger extension methods implemented by Microsoft.Extensions.Logging.LoggerExtensions will ignore these logger attributes.

    Declaration
    public static ILogger AddAttributes(this ILogger logger, Action<LogAttributes> attributeSetter)
    Parameters
    Type Name Description
    ILogger logger

    The logger being wrapped.

    Action<LogAttributes> attributeSetter

    Action used to add attributes to the logger.

    Returns
    Type Description
    ILogger

    An ILogger that will include the attributes in every event it logs.

    Remarks

    This method returns a new logger that includes the attributes added by the attributeSetter action.

    LogCriticalEx(ILogger, Exception, Func<string>, Action<LogAttributes>)

    Logs a critical exception with a message returned by a custom message function.

    Declaration
    public static void LogCriticalEx(this ILogger logger, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    The exception.

    Func<string> messageFunc

    Specifies the message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogCriticalEx(ILogger, Exception, string, Action<LogAttributes>)

    Logs a critical exception.

    Declaration
    public static void LogCriticalEx(this ILogger logger, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies the exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogCriticalEx(ILogger, Func<string>, Action<LogAttributes>)

    Logs a critical message retrieved via a message function.

    Declaration
    public static void LogCriticalEx(this ILogger logger, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Func<string> messageFunc

    The message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogCriticalEx(ILogger, string, Action<LogAttributes>)

    Logs a critical message.

    Declaration
    public static void LogCriticalEx(this ILogger logger, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    string message

    Specifies the message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogDebugEx(ILogger, Exception, Func<string>, Action<LogAttributes>)

    Logs a debug exception with a message returned by a custom message function..

    Declaration
    public static void LogDebugEx(this ILogger logger, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogDebugEx(ILogger, Exception, string, Action<LogAttributes>)

    Logs a debug exception.

    Declaration
    public static void LogDebugEx(this ILogger logger, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogDebugEx(ILogger, Func<string>, Action<LogAttributes>)

    Logs a debug message retrieved via a message function.

    Declaration
    public static void LogDebugEx(this ILogger logger, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogDebugEx(ILogger, string, Action<LogAttributes>)

    Logs a debug message.

    Declaration
    public static void LogDebugEx(this ILogger logger, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    string message

    Specifies message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogErrorEx(ILogger, Exception, Func<string>, Action<LogAttributes>)

    Logs an error exception with a message returned by a custom message function..

    Declaration
    public static void LogErrorEx(this ILogger logger, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogErrorEx(ILogger, Exception, string, Action<LogAttributes>)

    Logs an error exception.

    Declaration
    public static void LogErrorEx(this ILogger logger, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogErrorEx(ILogger, Func<string>, Action<LogAttributes>)

    Logs an error message retrieved via a message function.

    Declaration
    public static void LogErrorEx(this ILogger logger, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogErrorEx(ILogger, string, Action<LogAttributes>)

    Logs an error message.

    Declaration
    public static void LogErrorEx(this ILogger logger, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    string message

    Specifies message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogInformationEx(ILogger, Exception, Func<string>, Action<LogAttributes>)

    Logs a information exception with a message returned by a custom message function..

    Declaration
    public static void LogInformationEx(this ILogger logger, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogInformationEx(ILogger, Exception, string, Action<LogAttributes>)

    Logs an information exception.

    Declaration
    public static void LogInformationEx(this ILogger logger, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogInformationEx(ILogger, Func<string>, Action<LogAttributes>)

    Logs an information message retrieved via a message function.

    Declaration
    public static void LogInformationEx(this ILogger logger, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogInformationEx(ILogger, string, Action<LogAttributes>)

    Logs an information message.

    Declaration
    public static void LogInformationEx(this ILogger logger, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    string message

    Specifies message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogTraceEx(ILogger, Exception, Func<string>, Action<LogAttributes>)

    Logs a trace exception with a message returned by a custom message function..

    Declaration
    public static void LogTraceEx(this ILogger logger, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogTraceEx(ILogger, Exception, string, Action<LogAttributes>)

    Logs a trace exception.

    Declaration
    public static void LogTraceEx(this ILogger logger, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogTraceEx(ILogger, Func<string>, Action<LogAttributes>)

    Logs a trace message retrieved via a message function.

    Declaration
    public static void LogTraceEx(this ILogger logger, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogTraceEx(ILogger, string, Action<LogAttributes>)

    Logs a trace message.

    Declaration
    public static void LogTraceEx(this ILogger logger, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    string message

    Specifies message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogWarningEx(ILogger, Exception, Func<string>, Action<LogAttributes>)

    Logs a warning exception with a message returned by a custom message function..

    Declaration
    public static void LogWarningEx(this ILogger logger, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogWarningEx(ILogger, Exception, string, Action<LogAttributes>)

    Logs a warning exception.

    Declaration
    public static void LogWarningEx(this ILogger logger, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Exception exception

    Specifies exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogWarningEx(ILogger, Func<string>, Action<LogAttributes>)

    Logs a warning message retrieved via a message function.

    Declaration
    public static void LogWarningEx(this ILogger logger, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    Func<string> messageFunc

    Specifies message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogWarningEx(ILogger, string, Action<LogAttributes>)

    Logs a warning message.

    Declaration
    public static void LogWarningEx(this ILogger logger, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    string message

    Specifies message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogWithLevelEx(ILogger, LogLevel, Exception, Func<string>, Action<LogAttributes>)

    Logs an exception with a message returned by a custom message function with the specified LogLevel.

    Declaration
    public static void LogWithLevelEx(this ILogger logger, LogLevel logLevel, Exception exception, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    LogLevel logLevel

    Specifies the LogLevel.

    Exception exception

    The exception.

    Func<string> messageFunc

    Specifies the message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogWithLevelEx(ILogger, LogLevel, Exception, string, Action<LogAttributes>)

    Logs an exception retrieved via a message function with the specified LogLevel.

    Declaration
    public static void LogWithLevelEx(this ILogger logger, LogLevel logLevel, Exception exception, string message = null, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    LogLevel logLevel

    Specifies the LogLevel.

    Exception exception

    Specifies the exception.

    string message

    Optionally specifies the event message.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing attributes when the current log level prevents any log from being emitted, for better performance.

    LogWithLevelEx(ILogger, LogLevel, Func<string>, Action<LogAttributes>)

    Logs a message retrieved via a message function with the specified LogLevel.

    Declaration
    public static void LogWithLevelEx(this ILogger logger, LogLevel logLevel, Func<string> messageFunc, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    LogLevel logLevel

    Specifies the LogLevel.

    Func<string> messageFunc

    The message function.

    Action<LogAttributes> attributeSetter

    Optionally specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    LogWithLevelEx(ILogger, LogLevel, string, Action<LogAttributes>)

    Logs a message with the specified LogLevel.

    Declaration
    public static void LogWithLevelEx(this ILogger logger, LogLevel logLevel, string message, Action<LogAttributes> attributeSetter = null)
    Parameters
    Type Name Description
    ILogger logger

    Specifies the logger.

    LogLevel logLevel

    Specifies the LogLevel.

    string message

    Specifies the message.

    Action<LogAttributes> attributeSetter

    Specifies an action that can be used to add attributes to the event being logged.

    Remarks

    This method is intended mostly to avoid processing interpolated strings and attributes when the current log level prevents any log from being emitted, for better performance.

    In this article
    Back to top © Copyright 2005-2023 by NEONFORGE LLC