fix: logger does not panic anymore on reload.

cleanup: old lib version

Former-commit-id: 4dc9cc8048c8dd58438c8da8c2f2a57b16eaaec5
This commit is contained in:
Camillo Schenone 2024-08-04 19:51:55 +02:00
parent 7712d68cb5
commit b66b368907
5 changed files with 9 additions and 8 deletions

View file

@ -1 +1 @@
f629b2a823b8f4d351a4641f0f42bf84f95406c8 38750f240dab1caf464d1f46f00f09a1042fa194

View file

@ -1 +1 @@
5f1dfe7e8371de1f4967223a801cf49286065133 8ee9409baac472917d5a57fff2f6e584d90588a7

View file

@ -1 +0,0 @@
b736bf0e31e4e4fab5cdeaf75895fca09d18bc2b

View file

@ -17,7 +17,7 @@ echo "Building .SO with python: $PYO3_PYTHON"
env PYO3_PYTHON="${PYO3_PYTHON}" cargo build env PYO3_PYTHON="${PYO3_PYTHON}" cargo build
echo "Copying into: $TARGET_DIR/$SO_TARGET" echo "Copying into: $TARGET_DIR/$SO_TARGET"
echo "Building python wheel..." echo "Building python wheels..."
maturin build -i "$PYO3_PYTHON" maturin build -i "$PYO3_PYTHON"
wheels=($WHEEL_DIR/$WHEEL_NAME*.whl) wheels=($WHEEL_DIR/$WHEEL_NAME*.whl)

View file

@ -109,12 +109,14 @@ fn init_logger(py: Python<'_>, debug: Option<bool>) -> PyResult<Py<PyLogger>> {
.with_line_number(false) .with_line_number(false)
.with_source_location(false) .with_source_location(false)
.compact(); .compact();
tracing_subscriber::fmt()
let _ = tracing_subscriber::fmt()
.with_ansi(false) .with_ansi(false)
.event_format(format) .event_format(format)
.with_max_level(level) .with_max_level(level)
.with_writer(std::sync::Mutex::new(LoggerProducer(tx))) .with_writer(std::sync::Mutex::new(LoggerProducer(tx)))
.init(); .try_init();
Ok(Py::new(py, PyLogger(Arc::new(Mutex::new(rx))))?) Ok(Py::new(py, PyLogger(Arc::new(Mutex::new(rx))))?)
} }
@ -205,7 +207,7 @@ impl PyClient {
}; };
let Some(ws) = cli.as_ref().unwrap().get_workspace(id.as_str()) else { let Some(ws) = cli.as_ref().unwrap().get_workspace(id.as_str()) else {
return Ok(None) return Ok(None);
}; };
Python::with_gil(|py| Ok(Some(Py::new(py, PyWorkspace(ws))?))) Python::with_gil(|py| Ok(Some(Py::new(py, PyWorkspace(ws))?)))
@ -324,7 +326,7 @@ impl PyWorkspace {
path: String, path: String,
) -> PyResult<Option<Py<PyBufferController>>> { ) -> PyResult<Option<Py<PyBufferController>>> {
let Some(bufctl) = self.0.buffer_by_name(path.as_str()) else { let Some(bufctl) = self.0.buffer_by_name(path.as_str()) else {
return Ok(None) return Ok(None);
}; };
Ok(Some(Py::new(py, PyBufferController::from(bufctl))?)) Ok(Some(Py::new(py, PyBufferController::from(bufctl))?))