Review Request: extention of TIME_STAMP within kDebug
Parker Coates
parker.coates at kdemail.net
Tue Jun 8 20:28:04 BST 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4260/#review6041
-----------------------------------------------------------
Thank you. Just the other day I was debugging some race conditions in some animation code and was really wishing for this feature.
I'm not familiar with the internals of KDebug, so I can't really say if this is the best way to implement the behaviour. I'm also wondering if we really need two levels and whether it wouldn't be saner to just always include the milliseconds.
/branches/KDE/4.4/kdelibs/kdecore/io/kdebug.cpp
<http://reviewboard.kde.org/r/4260/#comment5633>
Why not do something like:
static int printTimeStamp = qgetenv("KDE_DEBUG_TIMESTAMP").toInt();
QByteArray programName;
s = s.nospace();
if (printTimeStamp > 0) {
if (printTimeStamp >= 2) {
// the extended print: 17:03:24.123
QString sformat = QString::fromAscii("hh:mm:ss.zzz");
s << qPrintable(QDateTime::currentDateTime().time().toString(sformat));
} else {
// the default print: 17:03:24
s << qPrintable(QDateTime::currentDateTime().time().toString());
}
s << ' ';
}
Otherwise, you're calling qgetenv every time the method is called. Using a real integer also allows you to properly handle values like -1 and 3.
/branches/KDE/4.4/kdelibs/kdecore/io/kdebug.cpp
<http://reviewboard.kde.org/r/4260/#comment5634>
Extra space.
/branches/KDE/4.4/kdelibs/kdecore/io/kdebug.cpp
<http://reviewboard.kde.org/r/4260/#comment5635>
Extra space.
- Parker
On 2010-06-08 17:58:41, Guy Maurel wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4260/
> -----------------------------------------------------------
>
> (Updated 2010-06-08 17:58:41)
>
>
> Review request for kdelibs.
>
>
> Summary
> -------
>
> If you export KDE_DEBUG_TIMESTAMP=1 then you'll get time information in front of every debug line.
> you get the time as
> 17:03:24
>
> If you want to get a little bit more, such as
> 17:03:24.123
>
> with the milliseconds, you export KDE_DEBUG_TIMESTAMP=2 and the extention, as proposed here
>
>
> Diffs
> -----
>
> /branches/KDE/4.4/kdelibs/kdecore/io/kdebug.cpp 1136017
>
> Diff: http://reviewboard.kde.org/r/4260/diff
>
>
> Testing
> -------
>
>
> Thanks,
>
> Guy
>
>
More information about the kde-core-devel
mailing list