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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//! Macros wrapped to avoid requiring direct dependencies from the end user.
/// Logs an info-level message with a dynamically generated `log_id`.
///
/// This macro automatically generates a `log_id` using the `log_id!` macro and uses the `Logger::target`
/// to determine the log target, which can be customized for the service. It then formats the message using
/// `$crate::__log_crate::info!` with the generated `log_id` and the provided message arguments.
///
/// # Example:
/// ```rust
/// use log4you::log_info;
/// log_info!("User logged in successfully");
/// ```
///
///
/// Logs a warning-level message with a dynamically generated `log_id`.
///
/// This macro generates a `log_id` using the `log_id!` macro and utilizes the `Logger::target`
/// to log the warning message with the `log_id` and the provided message arguments.
///
/// # Example:
/// ```rust
/// use log4you::log_warn;
/// log_warn!("Failed to load configuration");
/// ```
/// Logs an error-level message with a dynamically generated `log_id`.
///
/// This macro generates a `log_id` using the `log_id!` macro and utilizes the `Logger::target`
/// to log the error message with the `log_id` and the provided message arguments.
///
/// # Example:
/// ```rust
/// use log4you::log_error;
/// log_error!("An unexpected error occurred");
/// ```
/// Logs a debug-level message with a dynamically generated `log_id`.
///
/// This macro generates a `log_id` using the `log_id!` macro and utilizes the `Logger::target`
/// to log the debug message with the `log_id` and the provided message arguments.
///
/// # Example:
/// ```rust
/// use log4you::log_debug;
/// log_debug!("Debugging user session data");
/// ```
/// Logs an info-level message with a custom `log_id` provided as a parameter.
///
/// This macro allows specifying a custom `log_id` for logging messages at the info level, along
/// with the message arguments. The `Logger::target` is used to log the message to the appropriate service.
///
/// # Example:
/// ```rust
/// use log4you::log_info_with_id;
/// let email = "jerrymaheswara@gmail.com";
/// log_info_with_id!("CUSTOM_LOG_ID", "User logged in with email: {}", email);
/// ```
/// Logs a warning-level message with a custom `log_id` provided as a parameter.
///
/// This macro allows specifying a custom `log_id` for logging messages at the warning level, along
/// with the message arguments. The `Logger::target` is used to log the message to the appropriate service.
///
/// # Example:
/// ```rust
/// use log4you::log_warn_with_id;
/// log_warn_with_id!("CUSTOM_LOG_ID", "Configuration file missing, using defaults");
/// ```
/// Logs an error-level message with a custom `log_id` provided as a parameter.
///
/// This macro allows specifying a custom `log_id` for logging messages at the error level, along
/// with the message arguments. The `Logger::target` is used to log the message to the appropriate service.
///
/// # Example:
/// ```rust
/// use log4you::log_error_with_id;
/// log_error_with_id!("CUSTOM_LOG_ID", "Failed to connect to database");
/// ```
/// Logs a debug-level message with a custom `log_id` provided as a parameter.
///
/// This macro allows specifying a custom `log_id` for logging messages at the debug level, along
/// with the message arguments. The `Logger::target` is used to log the message to the appropriate service.
///
/// # Example:
/// ```rust
/// use log4you::log_debug_with_id;
/// log_debug_with_id!("CUSTOM_LOG_ID", "Debugging API response data");
/// ```
/// A macro to generate a log ID based on the current time using the `LogIdFormat` trait.
///
/// This macro generates a unique log ID by creating a UUID using the current timestamp (using the `now_v7` method),
/// and then formats it into a string without dashes (a 32-character string). The generated log ID is useful for tracing
/// log entries within a service and correlating events.
///
/// # Example:
/// ```rust
/// use log4you::log_id;
/// let log_id = log_id!();
/// println!("Generated Log ID: {}", log_id);
/// ```
///
/// This log ID is typically used for tracking the flow of requests or events through a system, ensuring consistency
/// and easy correlation across log entries.
///
/// # Dependencies:
/// - This macro depends on the `uuid` crate and expects that the `LogIdFormat` trait is implemented for `Uuid`.
/// - The generated log ID is a string representation of a UUID with dashes removed, typically 32 characters long.