On Sun, 2020-05-17 at 02:44 +0000, Doug Wegscheid wrote:
>
> is there a way to log to the sigrok logs from a decoder? I can
> see the APIs for tweaking the logging, but not for actually
> doing logging.

Your query lacks a little context or background. There is the
question *why* you'd want to log something, which kind of
information or situation that'd be.


Found inconsistent data in the decoder input? Emit error or
warning annotations so that users will see it. In the context
where the inconsistent data is viewed, with proper time stamps.
Let users see the connection of unexpected input and the message.

Got a bug or incomplete implementation of the decoder? Fix it,
improve the handling, or emit a warning annotation to make users
aware of incomplete protocol coverage.

Want to export decoder output to a file? Use the application's
export feature, it was made for this very purpose, works
transparently for all decoders, does not warrant another log
feature or custom extension.

Want to diagnose a decoder's internals during development of its
implementation? Use a debugger and/or add print() statements in
interesting spots. There is no need for custom logging to the
application's infrastructure. And strictly speaking development
hacks or debug messages should never be in shipped decoders. They
actually break tests, and thus are frowned upon when seen during
submission. They are a temporary hack, and go away as development
progresses, and get removed before submission and deployment.

What is left? Which situations do you encounter where a protocol
decoder _should_ log something to the application's log? Are
there any?


virtually yours
Gerhard Sittig
--
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.


_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to