CMS MessageLogger Service: Message Formatting

The various sorts of destinations produced by the CMS MessageLogger Service will perform appropriate formatting of the material streamed to compose messages. The .cfg file parameters and the user code sending the message can exert some degree of control over the formatting of messages destined for output files (or streams) or for log4cplus.

In the descriptions below, an item refers to one object streamed to the message. Thus in

  LogInfo ("category") "My Object number" << i << "is" << myObject;

there are four items.

Line Breaks

The output destination automatically indents by 7 characters (except on the first line, where those characters appear in the form %MSC-w plus one space. The destination inserts a line break (and the aforementioned indentation) before any item if appending that item to the current line would cause the line to exceed the desired linelength for that destination. (The default value for that line length is 80 columns; see

MessageLogger Parameters: Adjusting Linebreak Policy for details on how this can be modified by parmeters in the .cfg file.)

Spaces Between Items

Spaces are automatically inserted between items streamed to a message. Ordinarily, this is a nice convenience. For example, in the message

  LogInfo ("mycategory") "My Object number" << i << "is" << myObject;

it is likely that the user would prefer to see
%MSG-i mycategory: My Object number 125 is (32,100,102)
rather than
%MSG-i mycategory: My Object number125is(32,100,102)

However, sometimes the desired output is meant to have two items "running together." For example, the user may desire to display two numbers, separated by a slash, with no intervening spaces. Typically, the user concerned about this has a message prepared which explicitly contains any inter-item spaces desired.

When the logger encounters any item which ends in a space, it will assume that the user has prepared the message with all desired spaces, and will stop inserting any automatic spaces for the remainder of that message.

For example:

  char[] root = "myroot"; char[] branch="mybranch"; char[] leaf="myleaf" 
  LogInfo ("category") "Location is " << root << "/" << branch << "/" leaf;

would appear as

%MSG-i category:  Location is myroot/mybranch/leaf
rather than
%MSG-i category:  Location is  myroot / mybranch / leaf
Note that linebreaks (potentially inserted between items unless disabled for that destination) still apply.

-- SudhirMalik - 30-Aug-2011

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2011-08-30 - SudhirMalik
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback