mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: VppLog fixed issue with LOG_TIMESTAMP and long lines
git-svn-id: svn://ultimatepp.org/upp/trunk@8291 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e58fa32534
commit
cd6850090e
1 changed files with 7 additions and 2 deletions
|
|
@ -37,6 +37,8 @@ struct LogOut {
|
|||
|
||||
int part;
|
||||
|
||||
bool line_begin;
|
||||
|
||||
void Create(bool append);
|
||||
void Create() { Create(options & LOG_APPEND); }
|
||||
void Close();
|
||||
|
|
@ -62,6 +64,8 @@ void LogOut::Create(bool append)
|
|||
{
|
||||
Close();
|
||||
|
||||
line_begin = true;
|
||||
|
||||
int rotn = options >> 24;
|
||||
if(rotn) {
|
||||
char next[512];
|
||||
|
|
@ -174,7 +178,7 @@ void LogOut::Line(const char *s, int len, int depth)
|
|||
char h[600];
|
||||
char *p = h;
|
||||
int ll = 0;
|
||||
if(options & (LOG_TIMESTAMP|LOG_TIMESTAMP_UTC)) {
|
||||
if((options & (LOG_TIMESTAMP|LOG_TIMESTAMP_UTC)) && line_begin) {
|
||||
Time t = (options & LOG_TIMESTAMP_UTC) ? GetUtcTime() : GetSysTime();
|
||||
ll = sprintf(h, "%02d.%02d.%04d %02d:%02d:%02d ",
|
||||
t.day, t.month, t.year, t.hour, t.minute, t.second);
|
||||
|
|
@ -183,8 +187,9 @@ void LogOut::Line(const char *s, int len, int depth)
|
|||
p += ll;
|
||||
}
|
||||
char *beg = p;
|
||||
for(int q = depth; q--;)
|
||||
for(int q = min(depth, 99); q--;)
|
||||
*p++ = '\t';
|
||||
line_begin = len && s[len - 1] == '\n';
|
||||
memcpy(p, s, len);
|
||||
p += len;
|
||||
*p = '\0';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue