mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-09 00:50:04 +03:00
Add file and line number information to logs
This commit is contained in:
parent
7fbafc8030
commit
624467ebca
@ -9,6 +9,7 @@ pub mod test;
|
|||||||
use std::{
|
use std::{
|
||||||
cmp::{self, Ordering},
|
cmp::{self, Ordering},
|
||||||
ops::{AddAssign, Range, RangeInclusive},
|
ops::{AddAssign, Range, RangeInclusive},
|
||||||
|
panic::Location,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
@ -129,11 +130,13 @@ where
|
|||||||
{
|
{
|
||||||
type Ok = T;
|
type Ok = T;
|
||||||
|
|
||||||
|
#[track_caller]
|
||||||
fn log_err(self) -> Option<T> {
|
fn log_err(self) -> Option<T> {
|
||||||
match self {
|
match self {
|
||||||
Ok(value) => Some(value),
|
Ok(value) => Some(value),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
log::error!("{:?}", error);
|
let caller = Location::caller();
|
||||||
|
log::error!("{}:{}: {:?}", caller.file(), caller.line(), error);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user