# LogFormatter Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.logformatter/)

## ParseDate(string) {#parsedate-string-15dff175}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.logformatter/methods/parsedate-string-15dff175/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Logging/LogFormatter.cs#L36)

```csharp
public static DateTime ParseDate(string dateStr)
```

Parses a date.

### Parameters

- `dateStr` (`string`): The date string.

### Returns

The parsed date.

## PrintDate(DateTime) {#printdate-system-datetime-4d59c36e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.logformatter/methods/printdate-system-datetime-4d59c36e/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Logging/LogFormatter.cs#L26)

```csharp
public static string PrintDate(DateTime date)
```

Utility function to convert a `DateTime` object into printable data format used by the Logger subsystem.

### Parameters

- `date` (`DateTime`): The `DateTime` value to be printed.

### Returns

Formatted string representation of the input data, in the printable format used by the Logger subsystem.

## PrintException(Exception) {#printexception-system-exception-bac506f8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.logformatter/methods/printexception-system-exception-bac506f8/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Logging/LogFormatter.cs#L56-L61)

```csharp
public static string PrintException(Exception exception)
```

Utility function to convert an exception into printable format, including expanding and formatting any nested sub-expressions.

### Parameters

- `exception` (`Exception`): The exception to be printed.

### Returns

Formatted string representation of the exception, including expanding and formatting any nested sub-expressions.

## PrintTime(DateTime) {#printtime-system-datetime-59b85379}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.logformatter/methods/printtime-system-datetime-59b85379/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Logging/LogFormatter.cs#L46)

```csharp
public static string PrintTime(DateTime date)
```

Utility function to convert a `DateTime` object into printable time format used by the Logger subsystem.

### Parameters

- `date` (`DateTime`): The `DateTime` value to be printed.

### Returns

Formatted string representation of the input data, in the printable format used by the Logger subsystem.

## SetExceptionDecoder(Type, Func&lt;Exception, string&gt;) {#setexceptiondecoder-system-type-system-func-system-exception-string-dd574c55}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.logformatter/methods/setexceptiondecoder-system-type-system-func-system-exception-string-dd574c55/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Logging/LogFormatter.cs#L71-L72)

```csharp
public static void SetExceptionDecoder(Type exceptionType, Func<Exception, string> decoder)
```

Configures the exception decoder for the specified exception type.

### Parameters

- `exceptionType` (`Type`): The exception type to configure a decoder for.
- `decoder` (`Func<Exception, string>`): The decoder.
