enabled.
#include "zypp/base/Logger.h"
#include "zypp/base/LogControl.h"
+#include "zypp/base/ProfilingFormater.h"
#include "zypp/base/String.h"
#include "zypp/Date.h"
#include "zypp/PathInfo.h"
{
if ( getenv("ZYPP_LOGFILE") )
logfile( getenv("ZYPP_LOGFILE") );
+
+ if ( getenv("ZYPP_PROFILING") )
+ {
+ shared_ptr<LogControl::LineFormater> formater(new ProfilingFormater);
+ setLineFormater(formater);
+ }
}
public:
/** Default ctor: Singleton */
LogControl()
{}
- bool _log_microseconds;
};
///////////////////////////////////////////////////////////////////
/** \file zypp/base/LogControl.cc
*
*/
+
+#include <sys/time.h>
+
#include <iostream>
#include <fstream>
#include <string>
int line_r,
const std::string & message_r )
{
- static char hostname[1024];
- static char nohostname[] = "unknown";
- std::string now( Date::now().form( "%Y-%m-%d %H:%M:%S" ) );
- return str::form( "%s <%d> %s(%d) [%s] %s(%s):%d %s",
- now.c_str(), level_r,
- ( gethostname( hostname, 1024 ) ? nohostname : hostname ),
+ struct timeval tp;
+ int rtn;
+ rtn = gettimeofday( &tp, NULL);
+
+ return str::form( "%i.%i [%d] <%d> %s(%s):%d %s",
+ tp.tv_sec,
+ tp.tv_usec,
+ level_r,
getpid(),
- group_r.c_str(),
+ /*group_r.c_str(),*/
file_r, func_r, line_r,
message_r.c_str() );
}