libzypp  17.28.8
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-core/base/String.h>
20 
21 #include <zypp-core/base/ProfilingFormater.h>
22 
23 using std::endl;
24 
26 namespace zypp
27 {
29  namespace base
30  {
31 
33  // ProfilingFormater
35 
36  std::string ProfilingFormater::format( const std::string & group_r,
37  logger::LogLevel level_r,
38  const char * file_r,
39  const char * func_r,
40  int line_r,
41  const std::string & message_r )
42  {
43  struct timeval tp;
44  gettimeofday( &tp, NULL);
45 
46  return str::form( "%ld.%ld [%d] <%d> %s(%s):%d %s",
47  tp.tv_sec,
48  tp.tv_usec,
49  level_r,
50  getpid(),
51  /*group_r.c_str(),*/
52  file_r, func_r, line_r,
53  message_r.c_str() );
54  }
56  } // namespace base
59 } // namespace zypp
LogLevel
Definition of log levels.
Definition: Logger.h:145
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
virtual std::string format(const std::string &, logger::LogLevel, const char *, const char *, int, const std::string &)