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
//! # prettylog
//!
//! `prettylog` is a collection of functions to print log messages to terminal
//! with emojis and colors 😍
//!

/// Takes a message `&str` as input and
/// Prints <p style='color:red;'>🤦 ERROR : message</p> 
///
/// # Examples
///
/// ```
/// prettylog::error("This is an error message!");
/// ``` 
pub fn error(message: &str) {
    println!("🤦  \x1B[1;31mERROR :\x1B[0m \x1B[31m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:green;'>💁 INFO : message</p>
///
/// # Examples
///
/// ```
/// prettylog::info("This is an infomation!");
/// ```
pub fn info(message: &str) {
    println!("💁  \x1B[1;32mINFO :\x1B[0m \x1B[32m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:yellow;'>⚠️ WARN : message</p>
///
/// # Examples
///
/// ```
/// prettylog::warn("This is a warning!");
/// ```
pub fn warn(message: &str) {
    println!("⚠️  \x1B[1;33mWARN :\x1B[0m \x1B[33m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:blue;'>🙄 WAIT : message</p>
///
/// # Examples
///
/// ```
/// prettylog::wait("Compiling...");
/// ```
pub fn wait(message: &str) {
    println!("🙄  \x1B[1;34mWAIT :\x1B[0m \x1B[34m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:purple;'>🚨 CRITICAL : message</p>
///
/// # Examples
///
/// ```
/// prettylog::critical("Are you sure, you want to remove the file ?");
/// ```
pub fn critical(message: &str) {
    println!("🚨  \x1B[1;35mCRITICAL :\x1B[0m \x1B[35m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:cyan;'>⚡ CMD : message</p>
///
/// # Examples
///
/// ```
/// prettylog::command("echo $HOME");
/// ```
pub fn command(message: &str) {
    println!("⚡  \x1B[1;36mCMD :\x1B[0m \x1B[36m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:blue;'>🔗  LINK : </p> <p style='color:blue;text-decoration:underline'>message</p>
///
/// # Examples
///
/// ```
/// prettylog::link("echo $HOME");
/// ```
pub fn link(message: &str) {
    println!("🔗  \x1B[1;34mLINK :\x1B[0m \x1B[4;34m{}\x1B[0m", message);
}

/// Takes a message `&str` as input and
/// Prints <p style='color:grey;'>😴  MISC : message</p>
///
/// # Examples
///
/// ```
/// prettylog::misc("echo $HOME");
/// ```
pub fn misc(message: &str) {
    println!("😴  \x1B[2;37mMISC :\x1B[2;37m{}\x1B[0m", message);
}