# ResourceLoggerService

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResourceLoggerService.cs)
- Implements: `IDisposable`

A service that provides loggers for resources to write to.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public class ResourceLoggerService
    : System.IDisposable
{
    // ...
}
```

## Constructors

- [ResourceLoggerService](/reference/api/csharp/aspire.hosting/resourceloggerservice/constructors.md#constructor)

## Methods

- [ClearBacklog(string)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#clearbacklog-string) -- Clears the log stream's backlog for the resource.
- [Complete(IResource)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#complete-iresource) -- Completes the log stream for the resource.
- [Complete(string)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#complete-string) -- Completes the log stream for the resource.
- [Dispose](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#dispose) -- Disposes the service and completes all log streams.
- [GetAllAsync(IResource)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#getallasync-iresource) : `IAsyncEnumerable<IReadOnlyList<LogLine>>` -- 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.
- [GetAllAsync(string)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#getallasync-string) : `IAsyncEnumerable<IReadOnlyList<LogLine>>` -- 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.
- [GetLogger(IResource)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#getlogger-iresource) : `ILogger` -- Gets the logger for the resource to write to.
- [GetLogger(string)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#getlogger-string) : `ILogger` -- Gets the logger for the resource to write to.
- [WatchAnySubscribersAsync(CancellationToken)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#watchanysubscribersasync-cancellationtoken) : [IAsyncEnumerable<LogSubscriber>](/reference/api/csharp/aspire.hosting/logsubscriber.md) -- Watch for subscribers to the log stream for a resource.
- [WatchAsync(IResource)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#watchasync-iresource) : `IAsyncEnumerable<IReadOnlyList<LogLine>>` -- Watch for changes to the log stream for a resource.
- [WatchAsync(string)](/reference/api/csharp/aspire.hosting/resourceloggerservice/methods.md#watchasync-string) : `IAsyncEnumerable<IReadOnlyList<LogLine>>` -- Watch for changes to the log stream for a resource.
