Skip to content

Commit

Permalink
rust/semi-structured-logs: 2nd iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Aug 30, 2023
1 parent 2a20d52 commit 6649423
Show file tree
Hide file tree
Showing 6 changed files with 399 additions and 172 deletions.
90 changes: 90 additions & 0 deletions rust/semi-structured-logs/coverage-annotations.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
1| |/// various log levels
2| |// #[derive(Clone, PartialEq, Eq, Debug)]
3| 24|#[derive(Debug)]
------------------
| <semi_structured_logs::LogLevel as core::fmt::Debug>::fmt:
| 3| 24|#[derive(Debug)]
------------------
| Unexecuted instantiation: <semi_structured_logs::LogLevel as core::fmt::Debug>::fmt
------------------
4| |pub enum LogLevel {
5| | Info,
6| | Warning,
7| | Error,
8| | Debug,
9| |}
10| |
11| |/// primary function for emitting logs
12| 24|pub fn log(level: LogLevel, message: &str) -> String {
13| 24| // Use the Debug trait to convert the enum to string.
14| 24| let level_str: String = format!("{level:?}").to_uppercase();
15| 24|
16| 24| // Put the log line together.
17| 24| let log_line: String = format!("[{level_str}]: {message}");
18| 24|
19| 24| // Return the log line.
20| 24| log_line
21| 24|}
------------------
| semi_structured_logs::log:
| 12| 24|pub fn log(level: LogLevel, message: &str) -> String {
| 13| 24| // Use the Debug trait to convert the enum to string.
| 14| 24| let level_str: String = format!("{level:?}").to_uppercase();
| 15| 24|
| 16| 24| // Put the log line together.
| 17| 24| let log_line: String = format!("[{level_str}]: {message}");
| 18| 24|
| 19| 24| // Return the log line.
| 20| 24| log_line
| 21| 24|}
------------------
| Unexecuted instantiation: semi_structured_logs::log
------------------
22| |
23| 3|pub fn info(message: &str) -> String {
24| 3| log(LogLevel::Info, message)
25| 3|}
------------------
| semi_structured_logs::info:
| 23| 3|pub fn info(message: &str) -> String {
| 24| 3| log(LogLevel::Info, message)
| 25| 3|}
------------------
| Unexecuted instantiation: semi_structured_logs::info
------------------
26| |
27| 3|pub fn warn(message: &str) -> String {
28| 3| log(LogLevel::Warning, message)
29| 3|}
------------------
| semi_structured_logs::warn:
| 27| 3|pub fn warn(message: &str) -> String {
| 28| 3| log(LogLevel::Warning, message)
| 29| 3|}
------------------
| Unexecuted instantiation: semi_structured_logs::warn
------------------
30| |
31| 3|pub fn error(message: &str) -> String {
32| 3| log(LogLevel::Error, message)
33| 3|}
------------------
| semi_structured_logs::error:
| 31| 3|pub fn error(message: &str) -> String {
| 32| 3| log(LogLevel::Error, message)
| 33| 3|}
------------------
| Unexecuted instantiation: semi_structured_logs::error
------------------
34| |
35| 3|pub fn debug(message: &str) -> String {
36| 3| log(LogLevel::Debug, message)
37| 3|}
------------------
| semi_structured_logs::debug:
| 35| 3|pub fn debug(message: &str) -> String {
| 36| 3| log(LogLevel::Debug, message)
| 37| 3|}
------------------
| Unexecuted instantiation: semi_structured_logs::debug
------------------
5 changes: 5 additions & 0 deletions rust/semi-structured-logs/coverage-missing-lines.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Running: cargo llvm-cov --no-clean --all-features --workspace --show-missing-lines

Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/src/lib.rs 7 0 100.00% 6 0 100.00% 23 0 100.00% 0 0 -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL 7 0 100.00% 6 0 100.00% 23 0 100.00% 0 0 -

55 changes: 55 additions & 0 deletions rust/semi-structured-logs/report.lcov
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SF:/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/src/lib.rs
FN:23,_RNvCsfWXrn5J9T5y_20semi_structured_logs4info
FN:31,_RNvCsfWXrn5J9T5y_20semi_structured_logs5error
FN:27,_RNvCsfWXrn5J9T5y_20semi_structured_logs4warn
FN:35,_RNvCsfWXrn5J9T5y_20semi_structured_logs5debug
FN:3,_RNvXCsfWXrn5J9T5y_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt
FN:12,_RNvCsfWXrn5J9T5y_20semi_structured_logs3log
FN:23,_RNvCslsKOujzi6MT_20semi_structured_logs4info
FN:31,_RNvCslsKOujzi6MT_20semi_structured_logs5error
FN:27,_RNvCslsKOujzi6MT_20semi_structured_logs4warn
FN:3,_RNvXCslsKOujzi6MT_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt
FN:35,_RNvCslsKOujzi6MT_20semi_structured_logs5debug
FN:12,_RNvCslsKOujzi6MT_20semi_structured_logs3log
FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs4info
FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs5error
FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs4warn
FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs5debug
FNDA:8,_RNvXCsfWXrn5J9T5y_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt
FNDA:8,_RNvCsfWXrn5J9T5y_20semi_structured_logs3log
FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs4info
FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs5error
FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs4warn
FNDA:0,_RNvXCslsKOujzi6MT_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt
FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs5debug
FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs3log
FNF:6
FNH:6
DA:3,8
DA:12,8
DA:13,8
DA:14,8
DA:15,8
DA:16,8
DA:17,8
DA:18,8
DA:19,8
DA:20,8
DA:21,8
DA:23,1
DA:24,1
DA:25,1
DA:27,1
DA:28,1
DA:29,1
DA:31,1
DA:32,1
DA:33,1
DA:35,1
DA:36,1
DA:37,1
BRF:0
BRH:0
LF:23
LH:23
end_of_record
Loading

0 comments on commit 6649423

Please sign in to comment.