Skip to main content
Table of Contents

Class LoggerBackgroundTasksExtensions

Namespace
Stratara.Shared.Diagnostics.Extensions
Assembly
Stratara.Shared.dll

Source-generated structured-logging helpers for background-task / hosted-service lifecycle and per-job execution outcomes. Backed by LoggerMessageAttribute with stable event ids from LogEvents.BackgroundTasks.

public static class LoggerBackgroundTasksExtensions
Inheritance
LoggerBackgroundTasksExtensions
Inherited Members

Methods

LogJobFailedExecuted(ILogger, Exception)

Logs that a background job threw an unhandled exception during execution.

[LoggerMessage(EventId = 101003, Level = LogLevel.Error, Message = "An error occurred while executing a background job.")]
public static void LogJobFailedExecuted(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger to emit through.

exception Exception

The exception thrown by the job.

LogJobSuccessfulExecuted(ILogger, string)

Logs that a background job of a given CLR type executed without error.

[LoggerMessage(EventId = 101002, Level = LogLevel.Debug, Message = "Job of type {JobTypeName} successfully executed.")]
public static void LogJobSuccessfulExecuted(this ILogger logger, string jobTypeName)

Parameters

logger ILogger

The logger to emit through.

jobTypeName string

CLR type name of the job class.

LogQueuedHostedServiceStarted(ILogger)

Logs that the queued hosted service has started.

[LoggerMessage(EventId = 101001, Level = LogLevel.Information, Message = "Queued Hosted Service is running.")]
public static void LogQueuedHostedServiceStarted(this ILogger logger)

Parameters

logger ILogger

The logger to emit through.

LogQueuedHostedServiceStopped(ILogger)

Logs that the queued hosted service is shutting down.

[LoggerMessage(EventId = 101004, Level = LogLevel.Information, Message = "Queued Hosted Service is stopping.")]
public static void LogQueuedHostedServiceStopped(this ILogger logger)

Parameters

logger ILogger

The logger to emit through.