Macro exiting

Source
exiting!() { /* proc-macro */ }
Expand description

Log return from a function/method.

This is a convenience macro that can be used to log exiting from a function/method. It can be used without an alternative message. A possible use is to provide the function/method’s return value to track what is being passed-out.

If no alternative message is provided, then the default message, “Return”, is used.

A LogEntry is created with a log level of FINER, that is then logged.

§Parameters

§Examples

 #[logger]
 pub fn add_student(name: String, age: u8) -> bool {
     let mut rtn = false;

     entering!("name: {name}, age: {age}");

     /* Some processing that provides a result (rtn) */
     rtn = true;

     exiting!("rtn: {rtn}");
     rtn
 }

 fn main(){
     let name = "Mary Jane Thompson".to_string();
     let age = 18;

     if add_student(name, age) {
         println!("Success");
     } else {
         println!("Failure!");
     }
 }

Output:

|flogging->add_student| [FINER  ] Entry: (name: Mary Jane Thompson, age: 18)
|flogging->add_student| [FINER  ] Return: (rtn: true)
Success