## WriteIf(bool, string) {#writeif_4}

Writes the specified message to appenders if condition is true.

```csharp
public void WriteIf(bool condition, string message)
```

| Parameter | Type | Description |
| --- | --- | --- |
| condition | Boolean | The condition to test. |
| message | String | The message to write. |

### See Also

* class [Logger](../)
* namespace [Aspose.Email.Tools.Logging](../../logger/)
* assembly [Aspose.Email](../../../)

---

## WriteIf(bool, object) {#writeif_2}

Writes the specified message to appenders if condition is true.

```csharp
public void WriteIf(bool condition, object message)
```

| Parameter | Type | Description |
| --- | --- | --- |
| condition | Boolean | The condition to test. |
| message | Object | The message to write. |

### See Also

* class [Logger](../)
* namespace [Aspose.Email.Tools.Logging](../../logger/)
* assembly [Aspose.Email](../../../)

---

## WriteIf(bool, object, Exception) {#writeif_3}

Writes the specified message and exception to appenders if condition is true.

```csharp
public void WriteIf(bool condition, object message, Exception exception)
```

| Parameter | Type | Description |
| --- | --- | --- |
| condition | Boolean | The condition to test. |
| message | Object | The message to write. |
| exception | Exception | The exception to write. |

### See Also

* class [Logger](../)
* namespace [Aspose.Email.Tools.Logging](../../logger/)
* assembly [Aspose.Email](../../../)

---

## WriteIf(LogLevel, string) {#writeif}

Writes the specified message if the log level is enabled.

```csharp
public void WriteIf(LogLevel condition, string message)
```

| Parameter | Type | Description |
| --- | --- | --- |
| condition | LogLevel | The log level. |
| message | String | The message to log. |

### See Also

* class [LogLevel](../../loglevel/)
* class [Logger](../)
* namespace [Aspose.Email.Tools.Logging](../../logger/)
* assembly [Aspose.Email](../../../)

---

## WriteIf(LogLevel, string, Exception) {#writeif_1}

Writes the specified message and exception if the log level is enabled.

```csharp
public void WriteIf(LogLevel condition, string message, Exception exception)
```

| Parameter | Type | Description |
| --- | --- | --- |
| condition | LogLevel | The log level. |
| message | String | The message to log. |
| exception | Exception | The exception to log. |

### See Also

* class [LogLevel](../../loglevel/)
* class [Logger](../)
* namespace [Aspose.Email.Tools.Logging](../../logger/)
* assembly [Aspose.Email](../../../)


