libzypp: zypp/base/ProfilingFormater.cc Source File

libzypp 17.25.10

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
26 #include <zypp/base/ProfilingFormater.h>
27
28 using std::endl;
29
31 namespace zypp
32 {
34 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
Date.h
LogControl.h
Logger.h
PathInfo.h
ProfilingFormater.h
String.h
zypp::base::logger::LogLevel
LogLevel
Definition of log levels.
Definition: Logger.h:130
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
zypp::base::ProfilingFormater::format
virtual std::string format(const std::string &, logger::LogLevel, const char *, const char *, int, const std::string &)
Definition: ProfilingFormater.cc:41