altium/
logging.rs

1use std::sync::atomic::{AtomicU32, Ordering};
2
3use crate::common::buf2lstr;
4
5/// Track how many unsupported keys we have, useful for testing
6pub static UNSUPPORTED_KEYS: AtomicU32 = AtomicU32::new(0);
7
8/// Log the unsupported key
9pub fn log_unsupported_key(key: &[u8], val: &[u8]) {
10    UNSUPPORTED_KEYS.fetch_add(1, Ordering::Relaxed);
11    log::warn!("unsupported key {}={}", buf2lstr(key), buf2lstr(val));
12}
13
14/// Called from our proc macro to log a key
15pub fn macro_unsupported_key(name: &str, key: &[u8], val: &[u8]) {
16    UNSUPPORTED_KEYS.fetch_add(1, Ordering::Relaxed);
17    log::warn!(
18        "unsupported key for `{name}`: {}={} (via `FromRecord` derive)",
19        buf2lstr(key),
20        buf2lstr(val)
21    );
22}