Skip to content

Latest commit

 

History

History

examples

Examples

There are two example programs in this directory, buffer-parser and reader-parser corresponding to the two API styles. They demonstrate parsing a log file and printing out the timestamp and log-level of each message, as well as any multiline log messages.

Building

First, ensure you've built and installed the library by following these steps. Then run the following commands (from the repo's root):

# Generate the CMake project
cmake -S examples -B examples/build
# Build the project
cmake --build examples/build -j

Running

The example programs can be run as follows:

./examples/build/buffer-parser ./examples/schema.txt log.txt
./examples/build/reader-parser ./examples/schema.txt log.txt

where:

  • ./examples/schema.txt is a schema file containing rules for variables that should be parsed.
  • log.txt is a log file.