Star us on GitHub

Logging without a Rust framework

Learn how to set up Rust log ingestion.
Set up your SDK.

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

Install the log crate.

Highlight works with the log crate to make logging easier.

[dependencies] log = "0.4"
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 on 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}; // ... trace!("This is a trace! log. {:?}", "hi!"); debug!("This is a debug! log. {}", 3 * 3); info!("This is an info! log. {}", 2 + 2); warn!("This is a warn! log."); error!("This is an error! log.");
Verify your backend logs are being recorded.

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