Log enhancement

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 3

Log enhancement

Post by syedhs » Thu Jan 22, 2009 8:07 am

A few probably log features which I think is useful (useful to me):-
1) The ability to add 'hundreth of second' to time eg:-
Currently

Code: Select all

01:27:47: Creating resource group General
01:27:47: Creating resource group Internal
01:27:47: Creating resource group Autodetect
and the proposed change will result into something like this:-

Code: Select all

01:27:47.012: Creating resource group General
01:27:47.013: Creating resource group Internal
01:27:47.014: Creating resource group Autodetect
By default, Ogre log behavior should be the same as it is now, but you now have this additional function: LogManager::enableHundrethSecond();

2) The ability to add tab to the log messages:-
Currently

Code: Select all

01:27:47: Installing plugin: ParticleFX
01:27:47: Particle Emitter Type 'Point' registered
01:27:47: Particle Emitter Type 'Box' registered
01:27:47: Particle Emitter Type 'Ellipsoid' registered
01:27:47: Particle Emitter Type 'Cylinder' registered
01:27:47: Particle Emitter Type 'Ring' registered
and the proposed changes will result into something like this:-

Code: Select all

01:27:47: Installing plugin: ParticleFX
01:27:47:       Particle Emitter Type 'Point' registered
01:27:47:       Particle Emitter Type 'Box' registered
01:27:47:       Particle Emitter Type 'Ellipsoid' registered
01:27:47:       Particle Emitter Type 'Cylinder' registered
01:27:47:       Particle Emitter Type 'Ring' registered
The additional functions may be like this:-
LogManager::increaseIndent
LogManager::decreaseIndent
LogManager::clearIndent

Obviously, these are not that hard to implement, so I am offering to do the patches. :D
I created this thread to discuss the better function name or any other useful functions that I am missing.
0 x
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me

User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1140
Joined: Tue Jul 06, 2004 5:57 am
x 15
Contact:

Re: Log enhancement

Post by spookyboo » Thu Jan 22, 2009 10:12 am

How about an additional column with the severity (so not included as part of the message).

Code: Select all

01:27:47: INFO       Installing plugin: ParticleFX
01:27:47: INFO       Particle Emitter Type 'Point' registered
01:27:47: WARNING    bla, bla
01:27:47: EXCEPTION  bla, bla, ...
0 x

User avatar
steven
Gnoll
Posts: 657
Joined: Mon Feb 28, 2005 1:53 pm
Location: Australia - Canberra (ex - Switzerland - Geneva)
Contact:

Re: Log enhancement

Post by steven » Thu Jan 22, 2009 11:09 am

syedhs wrote: and the proposed changes will result into something like this:-

Code: Select all

01:27:47: Installing plugin: ParticleFX
01:27:47:       Particle Emitter Type 'Point' registered
01:27:47:       Particle Emitter Type 'Box' registered
01:27:47:       Particle Emitter Type 'Ellipsoid' registered
01:27:47:       Particle Emitter Type 'Cylinder' registered
01:27:47:       Particle Emitter Type 'Ring' registered
The additional functions may be like this:-
LogManager::increaseIndent
LogManager::decreaseIndent
LogManager::clearIndent
Mh... I did this in our engine.
Be warned that it is not so easy if the log manager is accessed from multiple threads.
You can do it correctly with lots of housekeeping... or use a simple & fast solution that sometimes will cause havoc to the indent. Check the LogManager in OGE CVS code (not the SVN because I removed the indent) if you want to see how to do a simple indent.
spookyboo wrote:How about an additional column with the severity (so not included as part of the message).

Code: Select all

01:27:47: INFO       Installing plugin: ParticleFX
01:27:47: INFO       Particle Emitter Type 'Point' registered
01:27:47: WARNING    bla, bla
01:27:47: EXCEPTION  bla, bla, ...
Our logmgr has also a similar methods but has we can choose either to log in an .html, .cvs or .txt we can have different way to represent the log level.
In html the font color is changed :)
0 x

CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
Contact:

Re: Log enhancement

Post by CABAListic » Thu Jan 22, 2009 11:24 am

Heh, as far as HTML logs go, I recently worked on a kind of prototype which can blend out certain types of messages so that you can focus on the interesting ones. I figure it might be useful in a more complex environment with several different parts. This is what I've come up with so far:
http://devel.oddbeat.de/logfile.html

I haven't actually written a corresponding log system yet, though.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Log enhancement

Post by jacmoe » Thu Jan 22, 2009 1:04 pm

The cool thing about the Ogre logmanager is that you can easily intercept it, and submit it to your own log-handler. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 3

Re: Log enhancement

Post by syedhs » Thu Jan 22, 2009 1:22 pm

steven wrote: Be warned that it is not so easy if the log manager is accessed from multiple threads.
I think the log manager class is not thread-safe. In the past, I inadvertently a few times invoking logMessage from different thread, and saw all those garbage characters in the log.

Spookyboo's additional column is nice, but may need further discussion so that it can be generalized - I dont know, that is just my thought. :)
0 x
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me

User avatar
steven
Gnoll
Posts: 657
Joined: Mon Feb 28, 2005 1:53 pm
Location: Australia - Canberra (ex - Switzerland - Geneva)
Contact:

Re: Log enhancement

Post by steven » Thu Jan 22, 2009 4:51 pm

Adding log in a thread-safe fation is the easy part.

What I spoke of was the fact that when you have multiple threads using the log manager
they will call addIndent and decIndent at any moment.
0 x

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: Log enhancement

Post by reptor » Thu Jan 22, 2009 6:35 pm

jacmoe wrote:The cool thing about the Ogre logmanager is that you can easily intercept it, and submit it to your own log-handler. :wink:
That's exactly what I am doing.

The formatting of the log file needs to be application-specific, as I see it.

I direct all log messages into the same file. Also do a little bit of my own formatting, to add a "severity" column like someone suggested here, and I also added the name of the subsystem which created the log message to the first columns. Because some subsystems (libraries not made by me) have it in the log message itself but others don't.
0 x

User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 3

Re: Log enhancement

Post by syedhs » Sat Jan 24, 2009 2:55 pm

I agree that for some more serious log customization, it is better handled with interception like Jacmoe described.

However, for smaller changes it is just easier to have them built-in the LogManager.
0 x
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me

Post Reply