[sheepdog] [PATCH v2 1/4] logger: add a mechanism for initializing log file with user specified callbacks

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Feb 5 06:08:07 CET 2013


At Tue, 05 Feb 2013 12:55:50 +0800,
Liu Yuan wrote:
> 
> On 02/05/2013 12:17 PM, Hitoshi Mitake wrote:
> > At Tue, 05 Feb 2013 11:01:57 +0800,
> > Liu Yuan wrote:
> >>
> >> On 02/05/2013 10:49 AM, Hitoshi Mitake wrote:
> >>> After applying this patch, a first log line produced by sheep will be
> >>> like this:
> >>> { "type": 0, "header": { "program": "sheep", "pid": 2500, "port":
> >>> 7000} }
> >>
> >> I think we'd better print the information necessary. So I guess you only
> >> need "port" field.
> >>
> >> isn't it simpler for json_formatter to inline "port" into every log
> >> message? Then I guess both sheep and json_log_viewer.py will get
> >> simplified a lot.
> >>
> > 
> > Currently json_log_viewer.py is an only user of JSON format. But we
> > can write other scripts which want logs to be formatted in JSON. And
> > they might want pid or other information which is not included in
> > current header.
> > 
> > So I believe current header + successor format is suitable.
> > 
> 
> I still insisting on the 'on-demand' design that only do the necessary
> things as much as possible. Json viewer is the only users and probably
> in a long time it is still the sole user. We can't afford to trade the
> complexity added to the logger for the future needs which isn't
> predicted clearly yet for now.
> 
> Inlining the field instead of adding a header looks stupid, but it works
> and doesn't require any viewer to write extra header parser.
> 

OK, I was convinced. I'll send a next version which includes your
opinion later.

Thanks,
Hitoshi



More information about the sheepdog mailing list