# Text Logs (syslog style)

In full-service and fog, the `mc-common` crate contains "logger" implementations based on the rust slog crate.

The `mc-sgx-slog` crate provides an `slog::Logger` appropriate for the enclave. It is recommended to refer to `mc_common::logger::Logger` in the portable `enclave-impl` crates, and put the calls to `mc-sgx-slog` in the `enclave-trusted` crates.

Most servers use the `mc_common::logger::create_app_logger` function at their entrypoint to create a logger for the server. This logger uses an in-memory buffer and a background thread to eventually write the log messages to where they are supposed to go.

The `create_root_logger` function sets up several possible log destinations:

* STDOUT (or STDERR if an environment variable is set)
* UDP-JSON logging (if enabled)
* Sentry logging (forwarding error and critical messages directly to Sentry servers)

The background thread is enabling the main thread to make progress asynchronously while these network calls are in progress.

(Note that this is very different from the "12 factor app" guidance: <https://12factor.net/logs>.)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mobilecoin.gitbook.io/full-service-api/usage/logging/text-logs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
