Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame^] | 1 | #include <iostream> |
| 2 | #include "elog.hpp" |
| 3 | #include "log.hpp" |
| 4 | |
| 5 | using namespace phosphor; |
| 6 | using namespace logging; |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | std::cout << "hello world!\n"; |
| 11 | |
| 12 | // Simple elog test |
| 13 | const char *test_string = "/tmp/test_string/"; |
| 14 | elog<file_not_found>(file_not_found::errnum(1), |
| 15 | file_not_found::file_path(test_string), |
| 16 | file_not_found::file_name("elog_test_1.txt")); |
| 17 | |
| 18 | log<level::DEBUG>("Info trace to log file path", |
| 19 | entry(file_not_found::file_path::str, |
| 20 | "/tmp/log_file_test/")); |
| 21 | |
| 22 | // pass parameter and previous_entry |
| 23 | elog<file_not_found>(file_not_found::errnum(2), |
| 24 | prev_entry<file_not_found::file_path>(), |
| 25 | file_not_found::file_name("elog_test_2.txt")); |
| 26 | |
| 27 | // Simple test to prove we fail to compile due to missing param |
| 28 | //elog<file_not_found>(file_not_found::errnum(1), |
| 29 | // file_not_found::file_path("test")); |
| 30 | |
| 31 | // Simple test to prove we fail to compile due to invalid param |
| 32 | //elog<file_not_found>(file_not_found::errnum(1), |
| 33 | // file_not_found::file_path("test"), |
| 34 | // file_not_found::file_name(1)); |
| 35 | |
| 36 | // Log tests |
| 37 | log<level::DEBUG>("Simple Example"); |
| 38 | |
| 39 | const char *file_name = "HELLO.txt"; |
| 40 | int number = 0xFEFE; |
| 41 | |
| 42 | log<level::DEBUG>("THIS IS A PHOSPHOR LOGGING TEST", |
| 43 | entry("FILE_NAME=%s_%x", file_name, number)); |
| 44 | |
| 45 | return 0; |
| 46 | } |