# ObservableLoggingMixins

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/mixins/trait-observableloggingmixins/

**trait** · [`ferroui-reactiveui`](/docs/0.5.0/api/ferroui-reactiveui/) · v0.5.0

```rust
trait ObservableLoggingMixins<T>
```

The extension methods of `ObservableLoggingMixins` on an observable.

Deviation (DEVIATIONS.md, ReactiveUI): the logging object is an `Rc` (the closures that log
keep it); a value is written with its `Debug` form where upstream calls `ToString()`; and the
overloads are named by what they take (`log`, `log_message`, `log_with_stringifier`;
`logged_catch`, `logged_catch_to`, `logged_catch_of`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L27)

## Members

- [`log`](#function-log)
- [`log_message`](#function-log_message)
- [`log_with_stringifier`](#function-log_with_stringifier)
- [`logged_catch`](#function-logged_catch)
- [`logged_catch_to`](#function-logged_catch_to)
- [`logged_catch_of`](#function-logged_catch_of)

<a id="function-log"></a>

### log

```rust
fn log<O: IEnableLogger + ?Sized + 'static>(self: &Self, log_object: Rc<O>) -> Rc<dyn IObservable<T>>
where T: fmt::Debug
```

Logs every notification at the level `Info` (`OnNext`, `OnCompleted`) or `Warn` (`OnError`)
through the logger of `log_object` (`Log<TObj>(TObj)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L30)

<a id="function-log_message"></a>

### log_message

```rust
fn log_message<O: IEnableLogger + ?Sized + 'static>(self: &Self, log_object: Rc<O>, message: Option<&str>) -> Rc<dyn IObservable<T>>
where T: fmt::Debug
```

`log` with `message` before each entry (`Log<TObj>(TObj, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L35)

<a id="function-log_with_stringifier"></a>

### log_with_stringifier

```rust
fn log_with_stringifier<O: IEnableLogger + ?Sized + 'static>(self: &Self, log_object: Rc<O>, message: Option<&str>, stringifier: impl Fn(&T) -> String + 'static) -> Rc<dyn IObservable<T>>
```

`log_message` that writes each value with `stringifier`
(`Log<TObj>(TObj, string?, Func<T, string>?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L41)

<a id="function-logged_catch"></a>

### logged_catch

```rust
fn logged_catch<O: IEnableLogger + ?Sized + 'static>(self: &Self, class: Rc<O>, next: Option<Rc<dyn IObservable<T>>>, message: Option<&str>) -> Rc<dyn IObservable<T>>
where T: Default + Clone
```

Continues with `next` (a sequence of the default value when `None`) when the source fails,
after a `Warn` entry with `message` in the logger of `class`
(`LoggedCatch<TObj>(TObj)`, `LoggedCatch<TObj>(TObj, IObservable<T>?)`,
`LoggedCatch<TObj>(TObj, IObservable<T>?, string?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L52)

<a id="function-logged_catch_to"></a>

### logged_catch_to

```rust
fn logged_catch_to<O: IEnableLogger + ?Sized + 'static>(self: &Self, class: Rc<O>, next: Rc<dyn IObservable<T>>, message: Option<&str>) -> Rc<dyn IObservable<T>>
```

`logged_catch` with the sequence to continue with, which needs no
default value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L63)

<a id="function-logged_catch_of"></a>

### logged_catch_of

```rust
fn logged_catch_of<O: IEnableLogger + ?Sized + 'static, E: Error + 'static>(self: &Self, class: Rc<O>, next: impl Fn(ObservableError) -> Rc<dyn IObservable<T>> + 'static, message: Option<&str>) -> Rc<dyn IObservable<T>>
```

Continues with the sequence `next` gives for the error when the source fails with an error
of the type `E`, after a `Warn` entry; other errors pass through
(`LoggedCatch<TObj, TException>(TObj, Func<TException, IObservable<T>>, string?)`). `next`
receives the error, which `downcast_ref::<E>` reads.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/observable_logging_mixins.rs#L74)

## Trait implementations

- [`ObservableLoggingMixins<T>`](/docs/0.5.0/api/ferroui-reactiveui/mixins/trait-observableloggingmixins/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
