Skip to content

Instantly share code, notes, and snippets.

@bradbishop
Last active March 19, 2019 13:53
Show Gist options
  • Save bradbishop/4d6e55315017ac40fe95a27b6c7954f8 to your computer and use it in GitHub Desktop.
Save bradbishop/4d6e55315017ac40fe95a27b6c7954f8 to your computer and use it in GitHub Desktop.
application exception context phosphor-loggingd journald
+-----+ +-----+ +-----+ +-----+
log event detected | | | | | | |
"producer" | | | | | | | |
| + | | | | | | |
+-------> | | | | | | | | |
| | | | | | | | | |
| elog() | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | +----------------------------------------------------------------------------------+ |
| | | | | | | | | |
| | | -> key value pairs, transaction ID -> | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | <----------------------------------------------------------------------------------< |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| phosphor logging | | | | | | | | |
| library | | | throw(T) | | | | | |
| | >-----------------------------+ | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | +--------------+ | | | |
| | | | | | | | | |
| | | | | | | | | |
| | +-----------------------------< | | | | |
| | | | catch(T) | | | | | |
| | | | | | | | | |
| commit() | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | >--------------------------+-----+-------------------------+ | | |
| | | private dbus api (commit(transaction id)) | | | | |
| | | | | | | | | |
+------> | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | +-----------------------+ |
| | | | | | | | + |
| | | | | | | find key value pairs(transaction ID)
| | | | | | | | | |
| | | | | <-----------------------+ |
| | | | | | | | |
| | | | | +-------------+ | |
| | | | | | | | | |
| | | | | | | instantiate Logging.Entry
| | | | | | | | | |
| | | | | <-------------+ | |
| | | | | | | | |
| | | | | v | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
+-----+ +-----+ +-----+ +-----+
Glossary:
message id: an enumeration for a location in the codebase
message arguments: source of truth for event metadata, known only to the event producer
event metadata: the content of the logging format (pel, sel, etc)
phosphor-logging +1:
message arguments are compile-time checked
phosphor-logging -1:
dbus api is private ("internal")
leads developers to conflating logging with error handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment