public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: Dave Brolley <brolley@redhat.com>
To: Dave Brolley <brolley@redhat.com>
Cc: sid@sources.redhat.com
Subject: Re: [patch] Add Logging Support for SID Components
Date: Fri, 30 May 2003 21:44:00 -0000	[thread overview]
Message-ID: <3ED7D11D.4070507@redhat.com> (raw)
In-Reply-To: <3ED7CCCB.4070004@redhat.com>

I forgot to explain what the new options actually do ......

o To use the logging facility a component inherits from 
fixed_attribute_map_with_logging_component
o The component's methods may then call the method
        log (sid::host_int_4 level, const char *fmt, ...)
o The component's ulog_out_pin will then be driven, once character at a 
time with the log message under the following conditions:
    - If the component's 'ulog-mode' attribute is "less" then the 
message will be output of the 'level' on the call to 'log' is less than 
or equal to the value of the component's 'ulog-level' attribute
    - If the component's 'ulog-mode' attribute is "equal" or "match" 
then the message will be output of the 'level' on the call to 'log' is 
equal to the value of the component's 'ulog-level' attribute

The command line option settings are stored in SessionCfg (specified 
before --board) and BoardCfg (specified after --board) and can be used 
to set these attributes for components using logging. If a sid-io-stdio 
component is connected to the component's ulog_out_pin, then 
--ulog-filename can be used to set its 'filename' attribute.

By default, a component inheriting from 
fixed_attribute_map_with_logging_component is set up for --ulog-level==0 
and --ulog-mode=less. By default a sid-io-stdout component writes to 
stdout. So, the default settings are for logging to stdout for log 
messages with a level of 0.

Dave

Dave Brolley wrote:

> Hi,
>
> The attached patch adds logging support for sid components in 3 stages:
>
> 1) Add a new level to the sid component heirarchy
>
>    o fixed_attribute_map_with_logging_component inherits 
> fixed_attribute_map_component and provides the logging capability
>    o An output pin, ulog_out_pin, is defined here through which the 
> log data is output.
>    o printf-like logging (my immediate need) is provided via the 'void 
> log (level, const char *fmt, ...)' method
>    o Attributes record the logging settings (see options below)
>    o A nice future addition would be a 'log (level)' method which 
> would return some kind of stream object.
>
> 2) Add capability to sid-io-stdio (sid/consoles/stdio.cxx) for writing 
> output to a file.
>
>    o This provides logging to stdout or to a via via the component's 
> ulog_out_pin
>
> 3) Expand the command line interface for sid
>
>    o 3 new options control logging behavior
>        --ulog-level=INTEGER
>        --ulog-mode={less|match|equal}
>        --ulog-file=FILENAME
>    o As with many options, these relate to the previous --board 
> specified or provide settings for all boards if specified before the 
> first --board option.
>    o The board level settings are kept in BoardCfg 
> (sid/main/dynamic/commonCfg.h) by inhereting a new UlogCfg
>    o The global level settings are kept in SessionCfg also by 
> inherting from UlogCfg
>    o Configuration may then use this info to set attributes and 
> connect pins in the desired components to activate the logging feature.
>
> NOTES:
> o I needed to use vsnprintf or vasprintf if available and so I added 
> checks for them in sid/component/configure.in
> o I needed to define _ISOC99_SOURCE for vsnprintf or _GNU_SOURCE for 
> vasprintf and so we now also have to define _BSD_SOURCE and 
> _SVID_SOURCE which are normally defined by default if no _XXXXX_SOURCE 
> is defined.
> o I included the regenerated sid/component/config.h in the patch so 
> you can see the new macros.
>
> I'm requesting review of this patch, especially the placement of the 
> new functionality in the component heirarchy and the configury changes 
> to sid/component.
>
> Thanks,
> Dave



  reply	other threads:[~2003-05-30 21:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-30 21:27 Dave Brolley
2003-05-30 21:44 ` Dave Brolley [this message]
2003-06-01 14:32 ` Frank Ch. Eigler
2003-06-01 23:52   ` Ben Elliston
2003-06-02  0:01     ` Dave Brolley
2003-06-09 14:15   ` Dave Brolley
2003-06-09 14:50     ` Frank Ch. Eigler
2003-06-09 17:03       ` Dave Brolley

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=3ED7D11D.4070507@redhat.com \
    --to=brolley@redhat.com \
    --cc=sid@sources.redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).