FARGOS/VISTA Object Management Environment Core
..
|
Reads a binary log, expands and formats as original plain text. If provided a text file, acts like 'cat'. More...
#include <read_binary_log.hpp>
Public Member Functions | |
ReadBinaryLog (OS_HANDLE_TYPE fd, OS_HANDLE_TYPE outputTo=_STDOUT_FD) | |
~ReadBinaryLog () | |
OS_HANDLE_TYPE | setNewOutputDescriptor (OS_HANDLE_TYPE newFD) |
virtual int | processBuffer (File_Buffer *bfrState) VIRTUAL_OVERRIDE |
Process buffer contents. More... | |
virtual int | processLine (const unsigned char *line, size_t lineLen) VIRTUAL_OVERRIDE |
Writes data to output descriptor. More... | |
![]() | |
Read_And_Process_File (OS_HANDLE_TYPE srcDescriptor, ReadModes mode=READ_NORMAL, const FileTypeReaderSelector *selectorTable=nullptr) | |
Construct from an existing file descriptor. More... | |
Read_And_Process_File (const char *fileName, ReadModes mode=READ_NORMAL, const FileTypeReaderSelector *selectorTable=nullptr) | |
Construct given the name of a file to be opened. More... | |
virtual | ~Read_And_Process_File () |
void | setReadRoutine (ReadDataFP altRoutine) OME_ALWAYS_INLINE |
Set a new file read routine. More... | |
virtual void | noteDataRead (const unsigned char *bfr, size_t bfrLen) const |
user-exit to see original copy of any data read More... | |
int | readAndProcessBlocksFromFile (size_t recordLength) |
Process fixed length records. More... | |
int | findAndProcessNextLine (File_Buffer *fileBfr, bool hasHeaderLine=false) |
Process next text line from buffer. More... | |
int | readAndProcessTextLines (bool hasHeaderLine=false) |
Process text lines. More... | |
int | readIntoFileBuffer (File_Buffer *bfr) |
int | readAndProcessFile () |
Process file contents with no imposed structure. More... | |
virtual int | beginFile () |
virtual int | completedFile (int recordsSeen) |
virtual int | processHeaderLine (unsigned char *line, size_t lineLen) |
Interface to handle special case processing of header lines. More... | |
virtual int_fast32_t | processBlock (unsigned char *block, size_t blockLen) |
Protected Types | |
enum | { WANT_LINE_HEADER, WANT_FILENAME, WANT_FORMAT, WANT_ARG_HEADER, WANT_ARG_VALUE, WANT_LINE_END, CHECK_FOR_BINARY_HEADER, COPY_AS_IS } |
Protected Member Functions | |
virtual int | outputAssembledLine () |
Process a binary log message buffer and convert to a formatted log line, then invoke processLine() to write the log line to the log file. More... | |
![]() | |
virtual int | readIntoBuffer (unsigned char *bfr, size_t bfrLen) |
Protected Attributes | |
uint32_t | parseState |
uint32_t | processedArgCount |
uint32_t | parseOffset |
uint32_t | fileNameLen |
uint32_t | formatStringLen |
OS_HANDLE_TYPE | outputToFD |
const char * | fileName |
const char * | formatString |
TimePointCache * | timePointCache |
LogLineBinaryHeader * | lineHeader |
LogLineBinaryValueHeader * | argHeader [LogMessageRecord::LOG_MAX_ARGUMENT_TOTAL] |
const unsigned char * | argData [LogMessageRecord::LOG_MAX_ARGUMENT_TOTAL] |
![]() | |
File_Buffer * | intermediateBuffer |
Additional Inherited Members | |
![]() | |
enum | ReadModes { READ_GUESS =0, READ_NORMAL =1, READ_ZLIB =2, READ_LZ4 =4, READ_PCAP =8, WRITE =16, WRITE_APPEND =WRITE | 32, WRITE_TRUNCATE =WRITE | 64, READ_FROM_SOCKET =128 } |
typedef int(* | ReadDataFP) (class Read_And_Process_File *input, unsigned char *bfr, uint32_t bfrLen) |
![]() | |
static int | defaultReadRoutine (Read_And_Process_File *input, unsigned char *bfr, uint32_t bfrLen) |
Default read routine. More... | |
static const FileTypeReaderSelector * | findTypeOfFile (const char *fileName, const FileTypeReaderSelector *selectorTable) |
static OS_HANDLE_TYPE | openFile (const char *fileName, ReadModes mode=READ_NORMAL) |
Open the indicated file. More... | |
static int | closeFile (OS_HANDLE_TYPE fd, ReadModes mode=READ_NORMAL) |
Close an native operating system file handle. More... | |
static int | findFileInPathsWithSuffixes (char *path, uint_fast32_t pathLen, const char *searchRootPaths, const char *possibleFilenames="", const char *possibleSuffixes="") |
Search for a file using a combination of directory roots and file suffixes. More... | |
![]() | |
ReadDataFP | readRoutine |
void * | auxData |
OS_HANDLE_TYPE | descriptor |
uint32_t | recordsProcessed |
enum ReadModes | readMode |
uint32_t | _explicitAlignmentPadding |
![]() | |
static uint32_t | matchFileHeader (const FileTypeReaderSelector *criteria, const unsigned char *fileHdr, const size_t hdrLen) |
Reads a binary log, expands and formats as original plain text. If provided a text file, acts like 'cat'.
|
protected |
|
inline |
|
inline |
References timePointCache.
|
protectedvirtual |
Process a binary log message buffer and convert to a formatted log line, then invoke processLine() to write the log line to the log file.
References argData, argHeader, LogLineBinaryValueHeader::argLength, byteAsLowercaseHexadecimal, byteAsUppercaseHexadecimal, fileName, fileNameLen, fixedpoint_to_ascii(), TimePointOfGranularity< UNITS >::formatIntoString(), formatString, POSIXtimeInUnits< UNITS >::getSeconds(), LogMessageRecord::getSeverityLabel(), LogLineBinaryHeader::importanceLevel, lineHeader, LogLineBinaryHeader::lineNumber, LogMessageRecord::LOG_ARG_TYPE_DOUBLE, LogMessageRecord::LOG_ARG_TYPE_HEX_FRAGMENT, LogMessageRecord::LOG_ARG_TYPE_HEX_FRAGMENT_UPPER, LogMessageRecord::LOG_ARG_TYPE_INT64, LogMessageRecord::LOG_DATESTAMP, LogMessageRecord::LOG_ERROR_LEVEL, LogMessageRecord::LOG_FILENAME, LogMessageRecord::LOG_LINE_NUMBER, LogMessageRecord::LOG_THREAD_ID, LogMessageRecord::LOG_TIMESTAMP, LogLineBinaryHeader::logPrefixMask, MAX_LINE_LEN, LogLineBinaryHeader::nanosecondTimestamp, OME_EXPECT_TRUE, OME_PREFETCH, TimePointOfGranularity< UNITS >::OUTPUT_DATE, TimePointOfGranularity< UNITS >::OUTPUT_TIME, processLine(), LogLineBinaryHeader::threadId, timePointCache, and uint_to_ascii().
Referenced by processBuffer().
|
virtual |
Process buffer contents.
bfrState | specifies the buffer to be processed. |
Reimplemented from Read_And_Process_File.
References File_Buffer::adjustBufferStart(), app(), argData, argHeader, LogLineBinaryValueHeader::argLength, LogLineBinaryValueHeader::argType, LogLineBinaryHeader::argumentCount, CHECK_FOR_BINARY_HEADER, COPY_AS_IS, File_Buffer::discardInitialBytes(), fileName, fileNameLen, formatString, formatStringLen, LogLineBinaryValueHeader::headerLen, lineHeader, LOG_CERR, LOG_COMPONENT_CERR, LOG_ENDLINE, LOG_LINE_BINARY_FORMAT_LE, LOG_LINE_BINARY_FORMAT_VER1, LogLineBinaryHeader::logLineLength, LogLineBinaryHeader::offsetFileName, LogLineBinaryHeader::offsetFirstArg, LogLineBinaryHeader::offsetFormatString, LogLineBinaryValueHeader::offsetNextArg, OME_PREFETCH, outputAssembledLine(), parseOffset, parseState, processedArgCount, processLine(), Read_And_Process_File::recordsProcessed, File_Buffer::spaceUsed(), File_Buffer::startBufferLocation(), WANT_ARG_HEADER, WANT_ARG_VALUE, WANT_FILENAME, WANT_FORMAT, WANT_LINE_END, and WANT_LINE_HEADER.
|
virtual |
Writes data to output descriptor.
Output a line to the log file.
line | points to the start of the log line. |
lineLen | indicates the length of the log line. |
0 | indicates the log line was written successfully |
-1 | indicates the log line was not completely written. |
Reimplemented from Read_And_Process_File.
References outputToFD.
Referenced by outputAssembledLine(), and processBuffer().
|
inline |
References OS_HANDLE_TYPE, and outputToFD.
|
protected |
Referenced by outputAssembledLine(), and processBuffer().
|
protected |
Referenced by outputAssembledLine(), and processBuffer().
|
protected |
Referenced by outputAssembledLine(), and processBuffer().
|
protected |
Referenced by outputAssembledLine(), and processBuffer().
|
protected |
Referenced by outputAssembledLine(), and processBuffer().
|
protected |
Referenced by processBuffer().
|
protected |
Referenced by outputAssembledLine(), and processBuffer().
|
protected |
Referenced by processLine(), ReadBinaryLog(), and setNewOutputDescriptor().
|
protected |
Referenced by processBuffer(), and ReadBinaryLog().
|
protected |
Referenced by processBuffer(), and ReadBinaryLog().
|
protected |
Referenced by processBuffer().
|
protected |
Referenced by outputAssembledLine(), ReadBinaryLog(), and ~ReadBinaryLog().
![]() | Generated: Fri Jul 31 2020 18:19:16
Support Information |