libzypp  13.10.6
ProfilingFormater.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #include <sys/time.h>
14 
15 #include <iostream>
16 #include <fstream>
17 #include <string>
18 
19 #include "zypp/base/Logger.h"
20 #include "zypp/base/LogControl.h"
21 #include "zypp/base/String.h"
22 #include "zypp/Date.h"
23 #include "zypp/PathInfo.h"
24 
25 
27 
28 using std::endl;
29 
31 namespace zypp
32 {
33  namespace base
35  {
36 
38  // ProfilingFormater
40 
41  std::string ProfilingFormater::format( const std::string & group_r,
42  logger::LogLevel level_r,
43  const char * file_r,
44  const char * func_r,
45  int line_r,
46  const std::string & message_r )
47  {
48  struct timeval tp;
49  gettimeofday( &tp, NULL);
50 
51  return str::form( "%ld.%ld [%d] <%d> %s(%s):%d %s",
52  tp.tv_sec,
53  tp.tv_usec,
54  level_r,
55  getpid(),
56  /*group_r.c_str(),*/
57  file_r, func_r, line_r,
58  message_r.c_str() );
59  }
61  } // namespace base
64 } // namespace zypp
LogLevel
Definition of log levels.
Definition: Logger.h:86
virtual std::string format(const std::string &, logger::LogLevel, const char *, const char *, int, const std::string &)
std::string form(const char *format,...)
Printf style construction of std::string.
Definition: String.cc:34