Comments (1)
there was a way presented around 2 months ago in the matrix chat iirc ( end of october), where you could siphon the log output and still dont loose the local log.
use core::ffi::{c_char, c_int};
use esp_idf_sys::{size_t, va_list};
use log::info;
extern "C" {
#[allow(improper_ctypes)]
pub fn vsnprintf(_: *mut c_char, _: size_t, _: *const c_char, _: va_list) -> c_int;
}
#[allow(improper_ctypes_definitions)]
unsafe extern "C" fn vprintf_trampoline(arg1: *const c_char, arg2: va_list) -> c_int {
const MAX_LEN: usize = 128;
let mut buf = [0u8; MAX_LEN];
let len = vsnprintf(buf.as_mut_ptr() as _, MAX_LEN as _, arg1, arg2);
if len < 0 {
info!("vsnprintf returned an error: {len}");
return len;
}
let s = &buf[0..(len as usize).min(MAX_LEN)]; // the min is just in case
match core::str::from_utf8(s) {
Ok(s) => info!("esp log received: {s}"),
Err(err) => info!("esp log received a non-utf8 string: {err}, {s:?}"),
}
len
}
unsafe { esp_idf_sys::esp_log_set_vprintf(Some(vprintf_trampoline)) };
esp_idf_svc::log::EspLogger::initialize_default();
hope this helps
from anemometer.
Related Issues (10)
- Enable MQTT client authentication for AWS IoT HOT 1
- Update Readme HOT 1
- minimal working OTA sample? HOT 2
- Move all const values for AWS interaction into the nvs conf partition HOT 1
- Remove device id from MQTT topic path in nvs conf HOT 1
- Create a persistent log in nvm
- Map private repro with AWS settings into directory tree
- Investigate power safe modes supported by the MCU
- Check restart reason to set boot timestamp.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anemometer.