X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/5fd8cc8409d0efadc07dfe8d6774ad9ff477663d..eeab3e6cade87c1fe0a5f3d93522e12ccb9ec2ab:/log.cc?ds=sidebyside diff --git a/log.cc b/log.cc index a760815..baf3c2f 100644 --- a/log.cc +++ b/log.cc @@ -1,6 +1,7 @@ #include "paxos.h" #include #include +#include "tprintf.h" // Paxos must maintain some durable state (i.e., that survives power // failures) to run Paxos correct. This module implements a log with @@ -22,7 +23,7 @@ log::logread(void) unsigned instance; from.open(name.c_str()); - printf ("logread\n"); + LOG("logread"); while (from >> type) { if (type == "done") { std::string v; @@ -31,15 +32,15 @@ log::logread(void) getline(from, v); pxs->values[instance] = v; pxs->instance_h = instance; - printf ("logread: instance: %d w. v = %s\n", instance, - pxs->values[instance].c_str()); + LOG("logread: instance: " << instance << " w. v = " << + pxs->values[instance]); pxs->v_a.clear(); pxs->n_h.n = 0; pxs->n_a.n = 0; } else if (type == "propseen") { from >> pxs->n_h.n; from >> pxs->n_h.m; - printf("logread: high update: %d(%s)\n", pxs->n_h.n, pxs->n_h.m.c_str()); + LOG("logread: high update: " << pxs->n_h.n << "(" << pxs->n_h.m << ")"); } else if (type == "accepted") { std::string v; from >> pxs->n_a.n; @@ -47,10 +48,9 @@ log::logread(void) from.get(); getline(from, v); pxs->v_a = v; - printf("logread: prop update %d(%s) with v = %s\n", pxs->n_a.n, - pxs->n_a.m.c_str(), pxs->v_a.c_str()); + LOG("logread: prop update " << pxs->n_a.n << "(" << pxs->n_a.m << ") with v = " << pxs->v_a); } else { - printf("logread: unknown log record\n"); + LOG("logread: unknown log record"); VERIFY(0); } } @@ -75,7 +75,7 @@ void log::restore(std::string s) { std::ofstream f; - printf("restore: %s\n", s.c_str()); + LOG("restore: " << s); f.open(name.c_str(), std::ios::trunc); f << s; f.close();