metaproxy  1.21.0
Public Member Functions | Public Attributes | List of all members
metaproxy_1::filter::Log::Impl::LFile Class Reference
Collaboration diagram for metaproxy_1::filter::Log::Impl::LFile:
Collaboration graph

Public Member Functions

 ~LFile ()
 
 LFile (std::string fname)
 
 LFile (std::string fname, FILE *outf)
 
void log (const std::string &date_format, std::ostringstream &os)
 
void flush ()
 

Public Attributes

boost::mutex m_mutex
 
std::string m_fname
 
FILE * fhandle
 

Detailed Description

Definition at line 79 of file filter_log.cpp.

Constructor & Destructor Documentation

◆ ~LFile()

mp::filter::Log::Impl::LFile::~LFile ( )

Definition at line 837 of file filter_log.cpp.

838 {
839 }

◆ LFile() [1/2]

mp::filter::Log::Impl::LFile::LFile ( std::string  fname)

Definition at line 827 of file filter_log.cpp.

827  :
828  m_fname(fname)
829 
830 {
831  if (fname.c_str())
832  fhandle = fopen(fname.c_str(), "a");
833  else
834  fhandle = 0;
835 }

References fhandle.

◆ LFile() [2/2]

metaproxy_1::filter::Log::Impl::LFile::LFile ( std::string  fname,
FILE *  outf 
)

Member Function Documentation

◆ flush()

void mp::filter::Log::Impl::LFile::flush ( )

Definition at line 866 of file filter_log.cpp.

867 {
868  if (fhandle)
869  fflush(fhandle);
870 }

◆ log()

void mp::filter::Log::Impl::LFile::log ( const std::string &  date_format,
std::ostringstream &  os 
)

Definition at line 841 of file filter_log.cpp.

843 {
844  if (fhandle)
845  {
846  char datestr[80];
847  time_t ti = time(0);
848 #if HAVE_LOCALTIME_R
849  struct tm tm0, *tm = &tm0;
850  localtime_r(&ti, tm);
851 #else
852  struct tm *tm = localtime(&ti);
853 #endif
854  if (strftime(datestr, sizeof(datestr)-1, date_format.c_str(), tm))
855  {
856  fputs(datestr, fhandle);
857  fputs(" ", fhandle);
858  }
859  fputs(os.str().c_str(), fhandle);
860  fputc('\n', fhandle);
861  }
862  else
863  yaz_log(YLOG_LOG, "%s", os.str().c_str());
864 }

Member Data Documentation

◆ fhandle

FILE* metaproxy_1::filter::Log::Impl::LFile::fhandle

Definition at line 83 of file filter_log.cpp.

Referenced by LFile().

◆ m_fname

std::string metaproxy_1::filter::Log::Impl::LFile::m_fname

Definition at line 82 of file filter_log.cpp.

◆ m_mutex

boost::mutex metaproxy_1::filter::Log::Impl::LFile::m_mutex

Definition at line 81 of file filter_log.cpp.


The documentation for this class was generated from the following file: