forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracing: init tracing-subscriber in intragration tests
- Loading branch information
Showing
15 changed files
with
551 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#![allow(clippy::doc_markdown)] | ||
//! Logging for the Integration Tests | ||
//! | ||
//! Tests should start their own logging. | ||
//! | ||
//! To find tests that do not start their own logging: | ||
//! | ||
//! ´´´ sh | ||
//! awk 'BEGIN{RS=""; FS="\n"} /#\[tokio::test\]\s*async\s+fn\s+\w+\s*\(\s*\)\s*\{[^}]*\}/ && !/#\[tokio::test\]\s*async\s+fn\s+\w+\s*\(\s*\)\s*\{[^}]*INIT\.call_once/' $(find . -name "*.rs") | ||
//! ´´´ | ||
//! | ||
use std::sync::Once; | ||
|
||
use tracing::level_filters::LevelFilter; | ||
|
||
#[allow(dead_code)] | ||
pub static INIT: Once = Once::new(); | ||
|
||
#[allow(dead_code)] | ||
pub fn tracing_stderr_init(filter: LevelFilter) { | ||
let builder = tracing_subscriber::fmt() | ||
.with_max_level(filter) | ||
.with_ansi(true) | ||
.with_writer(std::io::stderr); | ||
|
||
builder.pretty().with_file(true).init(); | ||
|
||
tracing::info!("Logging initialized"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod clock; | ||
pub mod fixtures; | ||
pub mod http; | ||
pub mod logging; | ||
pub mod udp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.