pub struct Config {
pub colors: HashMap<Severity, Color>,
pub bug_report: Option<HowToBugReport>,
}
Expand description
configuration struct for humantalk
Fields§
§colors: HashMap<Severity, Color>
colors hashmap for each severity level
bug_report: Option<HowToBugReport>
the bug reporting struct
Implementations§
source§impl Config
impl Config
sourcepub fn default() -> Config
pub fn default() -> Config
create a new configuration, with default colors and no bug report (auto-filled with default values on use)
sourcepub fn custom(
colors: HashMap<Severity, Color>,
bug_report: HowToBugReport
) -> Config
pub fn custom( colors: HashMap<Severity, Color>, bug_report: HowToBugReport ) -> Config
create a custom config, with your own colors and bug report. If you just want custom bug report, just use this code (inverse for colors):
use humantalk::{Config, Severity, HowToBugReport};
let my_config = Config::custom(
Config::default().colors,
HowToBugReport::new(
"message".to_string(),
"url".to_string()
)
);
sourcepub fn get_color(&self, severity: &Severity) -> Color
pub fn get_color(&self, severity: &Severity) -> Color
find the specified color for a given severity
sourcepub fn set_color(&mut self, severity: Severity, color: Color)
pub fn set_color(&mut self, severity: Severity, color: Color)
set the color for the specified severity level
sourcepub fn write(&self, severity: Severity, message: &str)
pub fn write(&self, severity: Severity, message: &str)
write a logging message to stdout. if the binary has been compiled with –release, it will not print debug assertions.
sourcepub fn machine_info(&self) -> String
pub fn machine_info(&self) -> String
get machine info represented as a string. Contains info including OS family, os, arch, rust version, llvm version and humantalk version
sourcepub fn fatal_error(&self, message: &str)
pub fn fatal_error(&self, message: &str)
error fatally, crashing the program. then exits with error code 3
, indincating that erroring out has succeeded