bool server_startup(server_startup_st *construct)
{
- Log;
+ Logn();
+
if (getenv(((char *)"MEMCACHED_SERVERS")))
{
construct->server_list= getenv(((char *)"MEMCACHED_SERVERS"));
construct->server_list= server_config_string;
}
- Log;
+ Logn();
srandom((unsigned int)time(NULL));
int _line_number;
public:
- log(const char *filename, int line_number) :
- _filename(filename),
- _line_number(line_number)
+ log() :
+ _filename(NULL),
+ _line_number(0)
+ { }
+
+ void set_filename(const char *filename, int line_number)
{
- if (_filename)
- {
- arg << _filename << ":" << _line_number << " ";
- }
+ _filename= filename;
+ _line_number= line_number;
}
~log()
template<class T>
log &operator<<(const T &x)
{
+ if (_filename)
+ {
+ arg << __FILE__ << ":" << __LINE__ << " ";
+ _filename= NULL;
+ }
arg << x;
return *this;
}
class cerr : public detail::log<detail::cerr> {
public:
- cerr(const char *filename, int line_number) :
- log(filename, line_number)
- { }
+ cerr(const char *filename, int line_number)
+ {
+ set_filename(filename, line_number);
+ }
};
class clog : public detail::log<detail::clog> {
public:
- clog(const char *filename, int line_number) :
- log(filename, line_number)
+ clog(const char *, int)
{ }
};
class cout : public detail::log<detail::cout> {
public:
- cout(const char *filename, int line_number) :
- log(filename, line_number)
+ cout(const char *, int)
{ }
};
#define Log stream::clog(NULL, __LINE__)
+#define Logn() stream::clog(NULL, __LINE__) << " "
+
} // namespace libtest
Error << "Failed while running on_error()";
break;
}
+
+ Logn();
}
if (next->post and world->runner->post)
stats_print(&stats);
- Error << " ";
void *retval;
pthread_join(thread, &retval);
- Error << " word";
delete world;
- Error << " after word";
return stats.failed == 0 and __shutdown == SHUTDOWN_GRACEFUL ? EXIT_SUCCESS : EXIT_FAILURE;
}