Skip to content

Commit

Permalink
Test logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciubix8513 committed Jul 8, 2024
1 parent 450b25b commit 2e5badc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

env:
CARGO_TERM_COLOR: always
WGPU_LOG_LEVEL: DEBUG

jobs:
build:
Expand All @@ -18,9 +19,9 @@ jobs:
- name: Build
run: cargo build
- name: Run doc tests
run: cargo test --doc
run: cargo test --doc -- --nocapture
- name: Run lib tests
run: cargo test --lib
run: cargo test --lib -- --nocapture
- name: Linting
run: cargo clippy -- -D warnings -D clippy::pedantic -D clippy::nursery
build-wasm:
Expand Down
4 changes: 2 additions & 2 deletions src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn parse_log_level(v: &str) -> log::LevelFilter {
}

#[allow(unused_mut)]
pub fn initialize_logging() {
pub fn initialize_logging() -> Result<(), lunar_logger::LoggerError> {
let mut log_level = log::LevelFilter::Info;
let mut engine_log_level = log::LevelFilter::Info;
let mut wgpu_log_level = log::LevelFilter::Warn;
Expand Down Expand Up @@ -44,5 +44,5 @@ pub fn initialize_logging() {
if log_to_file {
b = b.log_to_file();
}
b.init().unwrap();
b.init()
}
3 changes: 3 additions & 0 deletions src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ async fn gen_gpu_async(instance: &wgpu::Instance) -> (wgpu::Device, wgpu::Queue)

///Generates all the necessary gpu data for tests
pub(crate) fn generate_gpu() {
//Initialize logging
_ = crate::logging::initialize_logging();

let instance = wgpu::Instance::default();
let (device, queue) = block_on(gen_gpu_async(&instance));
#[cfg(not(target_arch = "wasm32"))]
Expand Down

0 comments on commit 2e5badc

Please sign in to comment.