ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/logger.C
(Generate patch)

Comparing deliantra/server/common/logger.C (file contents):
Revision 1.17 by root, Tue Apr 15 03:16:02 2008 UTC vs.
Revision 1.20 by root, Mon Oct 12 14:00:57 2009 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24#include <cstdarg> 25#include <cstdarg>
57#define PREFIX_LEN sizeof ("0000-00-00 00:00:00.0000+") - 1 58#define PREFIX_LEN sizeof ("0000-00-00 00:00:00.0000+") - 1
58 59
59static void 60static void
60log_sync (logline &line) 61log_sync (logline &line)
61{ 62{
62 struct tm *lt = localtime (&line.tv.tv_sec); 63 struct tm lt;
63 char pfx [PREFIX_LEN]; 64 char pfx [PREFIX_LEN];
64 65
66 localtime_r (&line.tv.tv_sec, &lt);
67
65 sprintf (pfx, "%04d-%02d-%02d %02d:%02d:%02d.%04d", 68 sprintf (pfx, "%04d-%02d-%02d %02d:%02d:%02d.%04d",
66 lt->tm_year + 1900, 69 lt.tm_year + 1900,
67 lt->tm_mon + 1, 70 lt.tm_mon + 1,
68 lt->tm_mday, 71 lt.tm_mday,
69 lt->tm_hour, 72 lt.tm_hour,
70 lt->tm_min, 73 lt.tm_min,
71 lt->tm_sec, 74 lt.tm_sec,
72 (int)(line.tv.tv_usec / 100) 75 (int)(line.tv.tv_usec / 100)
73 ); 76 );
74 77
75 pfx [PREFIX_LEN - 1] = line.flags & logSync ? '=' : ' '; 78 pfx [PREFIX_LEN - 1] = line.flags & logSync ? '=' : ' ';
76 79

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines