Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
BenchLogger Class Reference

#include <BenchLogger.h>

Public Member Functions

 BenchLogger ()
 
 ~BenchLogger ()
 
bool SetLogFile (const char file[])
 
void logError (const char msg[])
 
void logError (const SkString &str)
 
void logProgress (const char msg[])
 
void logProgress (const SkString &str)
 

Detailed Description

Class that allows logging to a file while simultaneously logging to stdout/stderr.

Definition at line 20 of file BenchLogger.h.

Constructor & Destructor Documentation

◆ BenchLogger()

BenchLogger::BenchLogger ( )

Definition at line 12 of file BenchLogger.cpp.

13: fFileStream(nullptr) {}

◆ ~BenchLogger()

BenchLogger::~BenchLogger ( )

Not virtual, since this class is not intended to be subclassed.

Definition at line 15 of file BenchLogger.cpp.

15 {
16 if (fFileStream) {
17 delete fFileStream;
18 }
19}

Member Function Documentation

◆ logError() [1/2]

void BenchLogger::logError ( const char  msg[])
inline

Log an error to stderr, taking a C style string as input.

Definition at line 38 of file BenchLogger.h.

38{ this->nativeLogError(msg); }

◆ logError() [2/2]

void BenchLogger::logError ( const SkString str)
inline

Log an error to stderr, taking an SkString as input.

Definition at line 43 of file BenchLogger.h.

43{ this->nativeLogError(str.c_str()); }
const char * c_str() const
Definition: SkString.h:133

◆ logProgress() [1/2]

void BenchLogger::logProgress ( const char  msg[])
inline

Log the progress of the bench tool to both stdout and the log file specified by SetLogFile, if any, taking a C style string as input.

Definition at line 49 of file BenchLogger.h.

49 {
50 this->nativeLogProgress(msg);
51 this->fileWrite(msg, strlen(msg));
52 }

◆ logProgress() [2/2]

void BenchLogger::logProgress ( const SkString str)
inline

Log the progress of the bench tool to both stdout and the log file specified by SetLogFile, if any, taking an SkString as input.

Definition at line 58 of file BenchLogger.h.

58 {
59 this->nativeLogProgress(str.c_str());
60 this->fileWrite(str.c_str(), str.size());
61 }
size_t size() const
Definition: SkString.h:131

◆ SetLogFile()

bool BenchLogger::SetLogFile ( const char  file[])

Specify a file to write progress logs to. Unless this is called with a valid file path, BenchLogger will only write to stdout/stderr.

Definition at line 21 of file BenchLogger.cpp.

21 {
22 fFileStream = new SkFILEWStream(file);
23 return fFileStream->isValid();
24}
bool isValid() const
Definition: SkStream.h:442

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