1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
#[macro_use]
extern crate lazy_static;
extern crate failure;
extern crate observer_attribute;

pub mod context;
mod event;
mod frame;
pub mod observe;
pub mod queue;
pub mod resulty;
mod utils;

pub use crate::context::Context;
pub use crate::event::{Event, OEvent, OID};
pub use crate::observe::observe;
use std::env;
pub type Result<T> = std::result::Result<T, failure::Error>;

lazy_static! {
    static ref LOG_DIR: String = env::var("OBSERVER_LOGS").unwrap_or("/var/log/".to_string());
}

pub fn check_path() -> String {
    format!("OBSERVER LOGDIR {:?}", LOG_DIR.to_string())
}

#[cfg(test)]
pub mod tests {
    #[test]
    fn test_log_path() {
        println!("LOGDIR {:?}", super::check_path());
    }
}

/*
enum Value {
    // all big query data types
};

type AttachedData = HashMap<String, Value>;

impl From<i32> for Value {
    fn from(v: i32) -> Value {
        Value::Int(v)
    }
}


pub fn attach(cd: mut AttachedData, key: &str, value: Into<Value>) {
    unimplemented!()
}
*/