Star us on GitHub
Star
Menu

Logging with actix-web

Learn how to set up highlight.io actix-web log ingestion.
1
Set up your highlight.io SDK.

First, make sure you've followed the backend getting started guide.

2
Install the log crate.

Highlight works with the log crate to make logging easier.

[dependencies] log = "0.4"
Copy
3
Call the logging facades.

Highlight::init automatically installs a logging backend, so you can call any of the log crate's macros to emit logs. NOTE: env_logger only logs errors to the console out by default, so to see your logs, run your project with the RUST_LOG=<crate name> environment variable, or RUST_LOG=trace to see everything.

use log::{trace, debug, info, warn, error}; // ... #[get("/")] async fn index() -> impl Responder { info!("Hello, world! Greet endpoint called."); format!("Hello, world!") }
Copy
4
Verify your backend logs are being recorded.

Visit the highlight logs portal and check that backend logs are coming in.