1
0
Fork 0
forked from wry/wry

autocommit 2022-04-29 17:35:55 CEST

This commit is contained in:
Julian Orth 2022-04-29 17:35:55 +02:00
parent aba40dc773
commit 9a0bfb3a72
2 changed files with 20 additions and 24 deletions

View file

@ -1,10 +1,9 @@
use {
crate::utils::{errorfmt::ErrorFmt, oserror::OsError, ptr_ext::MutPtrExt},
crate::utils::{errorfmt::ErrorFmt, oserror::OsError},
backtrace::Backtrace,
bstr::{BStr, BString, ByteSlice},
log::{Level, Log, Metadata, Record},
std::{
cell::UnsafeCell,
fs::DirBuilder,
io::Write,
os::unix::{ffi::OsStringExt, fs::DirBuilderExt},
@ -18,7 +17,7 @@ use {
};
#[thread_local]
static BUFFER: UnsafeCell<Vec<u8>> = UnsafeCell::new(Vec::new());
static mut BUFFER: Vec<u8> = Vec::new();
pub struct Logger {
level: AtomicU32,
@ -142,7 +141,7 @@ impl Log for LogWrapper {
if record.level() as u32 > self.logger.level.load(Relaxed) {
return;
}
let buffer = unsafe { BUFFER.get().deref_mut() };
let buffer = unsafe { &mut BUFFER };
buffer.clear();
let now = SystemTime::now();
let _ = if let Some(mp) = record.module_path() {