Skip to content

Commit

Permalink
feat(tracing): use tracing and zenoh-util log (#70)
Browse files Browse the repository at this point in the history
* feat(tracing): use tracing and zenoh-util log

Signed-off-by: gabrik <[email protected]>

* feat(tracing): using zenoh main branch

Signed-off-by: gabrik <[email protected]>

* fix: calling right function from module

Signed-off-by: gabrik <[email protected]>

* chore: using new try_init_log_from_env

Signed-off-by: gabrik <[email protected]>

---------

Signed-off-by: gabrik <[email protected]>
  • Loading branch information
gabrik authored Apr 18, 2024
1 parent a3cc923 commit c4b1587
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 72 deletions.
70 changes: 4 additions & 66 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ stats = ["zenoh/stats"]
[dependencies]
async-std = "=1.12.0"
async-trait = "0.1.66"
env_logger = "0.10.0"
git-version = "0.3.5"
lazy_static = "1.4.0"
log = "0.4.17"
rocksdb = "0.20.1"
serde_json = "1.0.94"
tracing = "0.1"
uhlc = "0.5.2"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "main", features = [
"unstable",
Expand Down
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

use async_std::sync::{Arc, Mutex};
use async_trait::async_trait;
use log::{debug, error, trace, warn};
use rocksdb::{ColumnFamilyDescriptor, Options, WriteBatch, DB};
use std::collections::HashMap;
use std::path::PathBuf;
use std::time::Duration;
use tracing::{debug, error, trace, warn};
use uhlc::NTP64;
use zenoh::buffers::{reader::HasReader, writer::HasWriter};
use zenoh::prelude::*;
Expand Down Expand Up @@ -76,9 +76,7 @@ impl Plugin for RocksDbBackend {
const PLUGIN_LONG_VERSION: &'static str = plugin_long_version!();

fn start(_name: &str, _config: &Self::StartArgs) -> ZResult<Self::Instance> {
// For some reasons env_logger is sometime not active in a loaded library.
// Try to activate it here, ignoring failures.
let _ = env_logger::try_init();
zenoh_util::try_init_log_from_env();
debug!("RocksDB backend {}", Self::PLUGIN_LONG_VERSION);

let root = if let Some(dir) = std::env::var_os(SCOPE_ENV_VAR) {
Expand Down

0 comments on commit c4b1587

Please sign in to comment.