* The MIT License (MIT)
* Copyright (C) 2024 Huawei Device Co., Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
use crate::TEST_LOG_LABEL;
use napi::{
hilog_debug, hilog_error, hilog_fatal, hilog_info, hilog_warn, oh_log_debug, oh_log_error,
oh_log_fatal, oh_log_info, oh_log_warn,
};
use napi_derive::napi;
#[napi]
pub fn oh_hilog_test() {
let a = 1;
let b = Some(2);
let c = String::from("hello napi");
let d = vec![1, 2, 3];
let e = "hello world";
oh_log_info!("oh_hilog_test");
oh_log_debug!("oh_hilog_test");
oh_log_error!("oh_hilog_test");
oh_log_warn!("oh_hilog_test");
oh_log_fatal!("oh_hilog_test");
oh_log_info!("oh_hilog_test, {}", a);
oh_log_debug!("oh_hilog_test, {:?}, {:?}", b, b);
oh_log_error!("oh_hilog_test, {}, {}, {}", c, c, c);
oh_log_warn!("oh_hilog_test, {:?}, {:?}, {:?}, {:?}", d, d, d, d);
oh_log_fatal!("oh_hilog_test, {}, {}, {}, {}, {}", e, e, e, e, e);
}
use napi::hilog;
use std::ffi::c_char;
#[napi]
pub fn oh_hilog_custom_test() {
let a = 1;
let b = Some(2);
let c = String::from("hello napi");
let d = vec![1, 2, 3];
let e = "hello world";
hilog_info!(TEST_LOG_LABEL, "oh_hilog_test");
hilog_debug!(TEST_LOG_LABEL, "oh_hilog_test");
hilog_error!(TEST_LOG_LABEL, "oh_hilog_test");
hilog_warn!(TEST_LOG_LABEL, "oh_hilog_test");
hilog_fatal!(TEST_LOG_LABEL, "oh_hilog_test");
hilog_info!(TEST_LOG_LABEL, "oh_hilog_test, {}", a);
hilog_debug!(TEST_LOG_LABEL, "oh_hilog_test, {:?}, {:?}", b, b);
hilog_error!(TEST_LOG_LABEL, "oh_hilog_test, {}, {}, {}", c, c, c);
hilog_warn!(
TEST_LOG_LABEL,
"oh_hilog_test, {:?}, {:?}, {:?}, {:?}",
d,
d,
d,
d
);
hilog_fatal!(
TEST_LOG_LABEL,
"oh_hilog_test, {}, {}, {}, {}, {}",
e,
e,
e,
e,
e
);
}