All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Patrick Williams" <patrick@stwcx.xyz>
Cc: OpenBMC List <openbmc@lists.ozlabs.org>
Subject: Re: `phosphor-logging` APIs (RFC)
Date: Thu, 29 Jul 2021 09:04:14 +0930	[thread overview]
Message-ID: <e1b41c2e-bcad-4282-a3b9-8f5344cab056@www.fastmail.com> (raw)
In-Reply-To: <YQD4TWus75QQjH3U@heinlein>

On Wed, 28 Jul 2021, at 15:55, Patrick Williams wrote:
> On Wed, Jul 28, 2021 at 03:22:43PM +0930, Andrew Jeffery wrote:
> > On Wed, 28 Jul 2021, at 05:54, Patrick Williams wrote:
> 
> > >     - Useful data is missing from `journalctl` resulting in people working
> > >       around it by generating strings with `fmt` et.al.
> > 
> > Sounds promising! Reading the proposal it seems like you're appending 
> > certain bits of structured data to the message. I think it would be 
> > nice if the data could be interpolated into arbitrary positions and not 
> > just appended (note, I'm not asking for interpolation of arbitrary 
> > variables here unlike what can be achieved with raw use of fmt, only 
> > those captured via the structured logging).
> 
> Can you give me a concrete example of what you mean by this?  I'm not
> understanding.

I've left a comment on the patch:

https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-logging/+/45310/1/docs/structured-logging.md#60

But duplicating that here, how I'd like to use the API and what I'd 
like to see in the resulting journal message is:

```
value = "xyz.openbmc_project.EntityManager";
lg2::error("Error talking to {ENTITY} error code is {ERRNO}", "ENTITY", value, "ERRNO", 2);
```

The lg2 implementation renders the values into the format string and 
forwards the result as MESSAGE to the journal, along with the 
structured values (ENTITY and ERRNO in the example).

```
$ journalctl -b
...
Nov 25 13:13:09 bmc fansensor[3006]: Error talking to xyz.openbmc_project.EntityManager error code is 2
...
```

Better yet would be if we could just forward the format string and 
journalctl renders this at invocation time, but we'd need to work with 
upstream on that.

Andrew

  reply	other threads:[~2021-07-28 23:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 20:24 `phosphor-logging` APIs (RFC) Patrick Williams
2021-07-28  5:52 ` Andrew Jeffery
2021-07-28  6:25   ` Patrick Williams
2021-07-28 23:34     ` Andrew Jeffery [this message]
2021-07-29  2:53       ` Patrick Williams
2021-08-03  0:27         ` Patrick Williams
2021-08-03  4:07           ` Andrew Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1b41c2e-bcad-4282-a3b9-8f5344cab056@www.fastmail.com \
    --to=andrew@aj.id.au \
    --cc=openbmc@lists.ozlabs.org \
    --cc=patrick@stwcx.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.