libzypp 17.37.17
ProfilingFormater.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include <sys/time.h>
14
15#include <iostream>
16#include <fstream>
17#include <string>
18
20
22
23using std::endl;
24
26namespace 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 }
55
56 } // namespace base
59} // namespace zypp
LogLevel
Definition of log levels.
Definition Logger.h:156
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition String.cc:39
Easy-to use interface to the ZYPP dependency resolver.
std::string format(const std::string &, logger::LogLevel, const char *, const char *, int, const std::string &) override