Skip to content

Commit

Permalink
fix(docs): fix documentation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertohuertasm committed Jan 30, 2023
1 parent a2b844a commit 84d3221
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dd-tracing-layer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dd-tracing-layer"
version = "0.1.0"
version = "0.1.1"
authors = ["Roberto Huertas <[email protected]>"]
description = "Send your logs to Datadog"
edition = "2021"
Expand Down
6 changes: 5 additions & 1 deletion dd-tracing-layer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ You can easily change the region or provide a custom URL if needed.
Here's a simple example of how to set it up and use it:

```rust
use dd_tracing_layer::DatadogOptions;
use tracing_subscriber::prelude::*;
use tracing::{instrument, subscriber};

#[instrument]
fn log(msg: &'static str) {
tracing::info!(format!("your message: {}", msg));
tracing::info!("your message: {}", msg);
}

fn main() {
Expand Down
32 changes: 18 additions & 14 deletions dd-tracing-layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@
//! ## Example
//!
//! ```rust
//!#[instrument]
//!fn log(msg: &'static str) {
//! tracing::info!(format!("your message: {}", msg));
//!}
//! use dd_tracing_layer::DatadogOptions;
//! use tracing_subscriber::prelude::*;
//! use tracing::{instrument, subscriber};
//!
//!fn main() {
//! let options = DatadogOptions::new("my-service", "my-datadog-api-key")
//! .with_tags("env:dev");
//! let dd = dd_tracing_layer::create(options);
//! let subscriber = tracing_subscriber::registry()
//! .with(tracing_subscriber::fmt::Layer::new().json())
//! .with(dd);
//! let _s = subscriber::set_default(subscriber);
//! log("hello world!");
//!}
//! #[instrument]
//! fn log(msg: &'static str) {
//! tracing::info!("your message: {}", msg);
//! }
//!
//! fn main() {
//! let options = DatadogOptions::new("my-service", "my-datadog-api-key")
//! .with_tags("env:dev");
//! let dd = dd_tracing_layer::create(options);
//! let subscriber = tracing_subscriber::registry()
//! .with(tracing_subscriber::fmt::Layer::new().json())
//! .with(dd);
//! let _s = subscriber::set_default(subscriber);
//! log("hello world!");
//! }
//!```
mod datadog_ingestor;

Expand Down
2 changes: 1 addition & 1 deletion log-tracing-layer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "log-tracing-layer"
version = "0.1.0"
version = "0.1.1"
authors = ["Roberto Huertas <[email protected]>"]
description = "Build your own custom tracing layer."
edition = "2021"
Expand Down

0 comments on commit 84d3221

Please sign in to comment.