ResourceLoggerService Methods
ClassMethods11 members
A service that provides loggers for resources to write to.
ClearBacklog(string)Section titled ClearBacklog(string) Clears the log stream's backlog for the resource.
public class ResourceLoggerService{ public void ClearBacklog( string resourceName) { // ... }}Parameters
resourceNamestringComplete(IResource)Section titled Complete(IResource) Completes the log stream for the resource.
public class ResourceLoggerService{ public void Complete( IResource resource) { // ... }}Complete(string)Section titled Complete(string) Completes the log stream for the resource.
public class ResourceLoggerService{ public void Complete( string name) { // ... }}Parameters
namestringThe name of the resource.DisposeSection titled Dispose Disposes the service and completes all log streams.
public class ResourceLoggerService{ public void Dispose() { // ... }} Get all logs for a resource. This will return all logs that have been written to the log stream for the resource and then complete.
public class ResourceLoggerService{ public IAsyncEnumerable<IReadOnlyList<LogLine>> GetAllAsync( IResource resource) { // ... }}Parameters
resourceIResourceThe resource to get all logs for.Returns
IAsyncEnumerable<IReadOnlyList<LogLine>>An async enumerable that returns all logs that have been written to the log stream and then completes. Get all logs for a resource. This will return all logs that have been written to the log stream for the resource and then complete.
public class ResourceLoggerService{ public IAsyncEnumerable<IReadOnlyList<LogLine>> GetAllAsync( string resourceName) { // ... }}Parameters
resourceNamestringThe resource nameReturns
IAsyncEnumerable<IReadOnlyList<LogLine>>An async enumerable that returns all logs that have been written to the log stream and then completes. Gets the logger for the resource to write to.
public class ResourceLoggerService{ public ILogger GetLogger( IResource resource) { // ... }}Parameters
resourceIResourceThe resource nameReturns
ILoggerAn Logging.ILogger which represents the resource. Gets the logger for the resource to write to.
public class ResourceLoggerService{ public ILogger GetLogger( string resourceName) { // ... }}Parameters
resourceNamestringThe name of the resource from the Aspire application model.Returns
ILoggerAn Logging.ILogger which represents the named resource.WatchAnySubscribersAsync(CancellationToken)Section titled WatchAnySubscribersAsync(CancellationToken)IAsyncEnumerable<LogSubscriber> Watch for subscribers to the log stream for a resource.
public class ResourceLoggerService{ public IAsyncEnumerable<LogSubscriber> WatchAnySubscribersAsync( CancellationToken cancellationToken = default(CancellationToken)) { // ... }}Parameters
cancellationTokenCancellationTokenoptionalReturns
IAsyncEnumerable<LogSubscriber> An async enumerable that returns when the first subscriber is added to a log, or when the last subscriber is removed. Watch for changes to the log stream for a resource.
public class ResourceLoggerService{ public IAsyncEnumerable<IReadOnlyList<LogLine>> WatchAsync( IResource resource) { // ... }}Parameters
resourceIResourceThe resource to watch for logs.Returns
IAsyncEnumerable<IReadOnlyList<LogLine>>An async enumerable that returns the logs as they are written. Watch for changes to the log stream for a resource.
public class ResourceLoggerService{ public IAsyncEnumerable<IReadOnlyList<LogLine>> WatchAsync( string resourceName) { // ... }}Parameters
resourceNamestringThe resource nameReturns
IAsyncEnumerable<IReadOnlyList<LogLine>>An async enumerable that returns the logs as they are written.