Skip to content

Latest commit

 

History

History

examples

Examples

The first two example programs in this directory are 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.

The third example is intersect-test which demonstrates the result of taking the intersection between a schema DFA and a search query DFA.

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
./examples/build/intersect-test

where:

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