[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: 571e1824727781789f475ea5b6
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: 571e1824727781789f475ea5b6d4f924c6173e0c |
Date: |
Sat, 1 Jan 2011 22:35:22 GMT |
revision: 571e1824727781789f475ea5b6d4f924c6173e0c
date: 2011-01-01T22:34:24
author: Richard Levitte <address@hidden>
branch: net.venge.monotone
changelog:
Add a semaphore around the call to date_t::as_formatted_localtime in
user_interface::output_prefix, so that logs being made down the line do
not cause infinite recursion.
Closes issue 122
manifest:
format_version "1"
new_manifest [f1a5c27df40d3e002ee953cb2794a5cecae54477]
old_revision [06052b90a0210c1a082113880cae42552f769133]
patch "dates.cc"
from [602419695490292f43358e4cc93c24f294a46265]
to [02648f8882988ad5122eccc39528249b6333b219]
patch "ui.cc"
from [9a60b8ed417f2566d2fc217decfdffee59e2a66e]
to [d003e3d9943dee48b7352f6f0f64e8821bb4a38f]
============================================================
--- ui.cc 9a60b8ed417f2566d2fc217decfdffee59e2a66e
+++ ui.cc d003e3d9943dee48b7352f6f0f64e8821bb4a38f
@@ -767,12 +767,22 @@ user_interface::output_prefix()
if (timestamps_enabled) {
try {
- // FIXME: with no app pointer around we have no access to
- // app.lua.get_date_format_spec() here, so we use the same format
- // which f.e. also Apache uses for its log output
- prefix = "[" +
- date_t::now().as_formatted_localtime("%a %b %d %H:%M:%S %Y") +
- "] ";
+ // To prevent possible infinite loops from a spurious log being
+ // made down the line from the call to .as_formatted_localtime,
+ // we temporarly turn off timestamping. Not by fiddling with
+ // timestamp_enabled, though, since that one might be looked at
+ // by some other code.
+ static int do_timestamp = 0;
+
+ if (++do_timestamp == 1) {
+ // FIXME: with no app pointer around we have no access to
+ // app.lua.get_date_format_spec() here, so we use the same format
+ // which f.e. also Apache uses for its log output
+ prefix = "[" +
+ date_t::now().as_formatted_localtime("%a %b %d %H:%M:%S %Y") +
+ "] ";
+ }
+ --do_timestamp;
}
// ensure that we do not throw an exception because we could not
// create the timestamp prefix above
============================================================
--- dates.cc 602419695490292f43358e4cc93c24f294a46265
+++ dates.cc 02648f8882988ad5122eccc39528249b6333b219
@@ -363,8 +363,6 @@ dump(date_t const & d, string & s)
s = d.as_iso_8601_extended();
}
-// WARNING: do not log anything within this function; since this is used in
-// user_interface::output_prefix() this might lead to an indefinite loop!
string
date_t::as_formatted_localtime(string const & fmt) const
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: 571e1824727781789f475ea5b6d4f924c6173e0c,
code <=