-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change the Log enum to a trait, add note to log to specify the log ms…
…g and add extend the prelude
- Loading branch information
Showing
3 changed files
with
76 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use crate::prelude::*; | ||
|
||
/// A simple error struct, please use it only when making a custom error | ||
/// structure is irrelevant. Use instead custom error structs. | ||
pub struct SimpleLog { | ||
level: LogLevel, | ||
msg: String, | ||
note: Option<String>, | ||
location: CodeSpan, | ||
} | ||
|
||
impl Log for SimpleLog { | ||
fn location(&self) -> CodeSpan { | ||
self.location.clone() | ||
} | ||
|
||
fn level(&self) -> LogLevel { | ||
self.level.clone() | ||
} | ||
|
||
fn note(&self) -> Option<String> { | ||
self.note.clone() | ||
} | ||
|
||
fn msg(&self) -> String { | ||
self.msg.clone() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub use super::{BuiltLog, FmtToken, Log, LogContext}; | ||
pub use super::{BuiltLog, CodeSpan, FmtToken, Log, LogContext, LogLevel}; |