Page 1 of 1

Redirect printf and Console to custom function

Posted: Wed Oct 27, 2021 5:18 pm
by elektron314
Can I redirect/reroute printf functions and also all console messages to my own written functions? What exactly I need is to route them to my own software uart that I have written by myself. Why? 3 HW UARTS are very busy already doing their job and we need one more SW UART for getting messages from the processor. :geek:

Re: Redirect printf and Console to custom function

Posted: Thu Oct 28, 2021 2:27 am
by username
Search the forum, this has been asked a few times in the past.

Re: Redirect printf and Console to custom function

Posted: Thu Oct 28, 2021 5:29 am
by elektron314
username wrote:
Thu Oct 28, 2021 2:27 am
Search the forum, this has been asked a few times in the past.
Already done. I have found different solutions but not redirecting to SW UART or my own custom function.

Re: Redirect printf and Console to custom function

Posted: Mon Nov 15, 2021 7:38 am
by elektron314
But does anybody know how to exactly redirect printf to my own function?

Re: Redirect printf and Console to custom function

Posted: Tue Nov 16, 2021 5:47 am
by chegewara

Re: Redirect printf and Console to custom function

Posted: Mon Dec 11, 2023 11:51 pm
by kohait00
quite some information provided here, but..

this is not for the real printf, which goes over vfs console file descriptors
this is all is for the ESP_LOGx facility..

hence again, the question:
is there an easy way to override the destination for printf (whatever is defined in sdkconfig) to, say, log in a buffer ?
I mean without messing with the vfs or trying to redirect or sth like that..
Any help is appreciated