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
use crate::;
use *;
use CString;
/// Logs a formatted message.
///
/// A wrapper around the [`Alpm::log_action`] function that acts similar to writeln!.
///
/// Unline the [`Alpm::log_action`] function this macro automatically appends a newline to the message.
///
/// The first argument is a handle to alpm.
///
/// The second is the message prefix. This is usually the name of your program doing the logging.
///
/// The third and following arguments are the same as [`format!`]. The third argument must be a string
/// literal.
///
/// Like [Alpm::log_action`] this returns a Result.
///
/// # Examples
///
/// ```
/// # use alpm::{Alpm, log_action};
/// # let handle = Alpm::new("/", "tests/db").unwrap();
/// log_action!(handle, "coolprogram", "starting transaction").unwrap();
/// log_action!(handle, "coolprogram", "installing package {}", "xorg").unwrap();
/// log_action!(handle, "coolprogram", "installing packages {pkg1} {pkg2}", pkg1 = "xorg", pkg2 = "git").unwrap();
/// ```