From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6394 invoked by alias); 30 May 2003 21:44:42 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 6386 invoked from network); 30 May 2003 21:44:41 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 30 May 2003 21:44:41 -0000 Received: from redhat.com (to-dhcp3.toronto.redhat.com [172.16.14.103]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 03ECE800025; Fri, 30 May 2003 17:44:41 -0400 (EDT) Message-ID: <3ED7D11D.4070507@redhat.com> Date: Fri, 30 May 2003 21:44:00 -0000 From: Dave Brolley User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3 X-Accept-Language: en-us MIME-Version: 1.0 To: Dave Brolley Cc: sid@sources.redhat.com Subject: Re: [patch] Add Logging Support for SID Components References: <3ED7CCCB.4070004@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-q2/txt/msg00038.txt.bz2 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