libzypp  10.5.0
ProfilingFormater.cc
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00013 #include <sys/time.h>
00014 
00015 #include <iostream>
00016 #include <fstream>
00017 #include <string>
00018 
00019 #include "zypp/base/Logger.h"
00020 #include "zypp/base/LogControl.h"
00021 #include "zypp/base/String.h"
00022 #include "zypp/Date.h"
00023 #include "zypp/PathInfo.h"
00024 
00025 
00026 #include "zypp/base/ProfilingFormater.h"
00027 
00028 using std::endl;
00029 
00031 namespace zypp
00032 { 
00033 
00034   namespace base
00035   { 
00036 
00038     // ProfilingFormater
00040 
00041     std::string ProfilingFormater::format( const std::string & group_r,
00042                                                   logger::LogLevel    level_r,
00043                                                   const char *        file_r,
00044                                                   const char *        func_r,
00045                                                   int                 line_r,
00046                                                   const std::string & message_r )
00047     {
00048       struct timeval tp;
00049       gettimeofday( &tp, NULL);
00050 
00051       return str::form( "%ld.%ld [%d] <%d> %s(%s):%d %s",
00052                         tp.tv_sec,
00053                         tp.tv_usec,
00054                         level_r,
00055                         getpid(),
00056                         /*group_r.c_str(),*/
00057                         file_r, func_r, line_r,
00058                         message_r.c_str() );
00059     }
00061   } // namespace base
00064 } // namespace zypp