Skip to content

Commit

Permalink
Initial release of log-surgeon.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlion committed Apr 26, 2023
1 parent 5e8a17c commit bec4a26
Show file tree
Hide file tree
Showing 63 changed files with 6,933 additions and 504 deletions.
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
BasedOnStyle: LLVM
ColumnLimit: 100
IndentWidth: 4
---
Language: Cpp
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
ContinuationIndentWidth: 8
NamespaceIndentation: Inner
PackConstructorInitializers: CurrentLine
PointerAlignment: Left
QualifierAlignment: Right
ReflowComments: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
# AfterFunctionDeclarationName: true
# AfterFunctionDefinitionName: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
Standard: Latest
26 changes: 26 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
Checks: 'cert-*,clang-analyzer-*,clang-diagnostic-*,cppcoreguidelines-*,modernize-*,performance-*,readability-*,-readability-identifier-length,-readability-simplify-boolean-expr'
FormatStyle: file
HeaderFileExtensions: ['','h','hh','hpp','hxx','tpp']
ImplementationFileExtensions: ['','c','cc','cpp','cxx']
CheckOptions:
readability-identifier-naming.ClassCase: 'CamelCase'
readability-identifier-naming.ClassMemberCase: 'lower_case'
readability-identifier-naming.ClassMemberPrefix: 'm_'
readability-identifier-naming.ClassMethodCase: 'lower_case'
readability-identifier-naming.ConstexprVariableCase: 'CamelCase'
readability-identifier-naming.ConstexprVariablePrefix: 'c'
readability-identifier-naming.EnumCase: 'CamelCase'
readability-identifier-naming.EnumConstantCase: 'CamelCase'
readability-identifier-naming.GlobalConstantCase: 'CamelCase'
readability-identifier-naming.GlobalConstantPrefix: 'c'
readability-identifier-naming.GlobalFunctionCase: 'lower_case'
readability-identifier-naming.GlobalVariableCase: 'lower_case'
readability-identifier-naming.LocalVariableCase: 'lower_case'
readability-identifier-naming.MemberCase: 'lower_case'
readability-identifier-naming.MemberPrefix: 'm_'
readability-identifier-naming.MethodCase: 'lower_case'
readability-identifier-naming.ParameterCase: 'lower_case'
readability-identifier-naming.StructCase: 'CamelCase'
readability-identifier-naming.TypedefCase: 'CamelCase'
readability-identifier-naming.UnionCase: 'CamelCase'
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Bug Report"
description: Report software deficiencies
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Use this form to report any functional or performance bugs you've found in the software.
Be sure to check if your [issue](https://github.com/y-scope/log-surgeon/issues) has already been reported.
- type: textarea
attributes:
label: Bug
description: "Describe what's wrong and if applicable, what you expected instead."
validations:
required: true

- type: input
attributes:
label: log-surgeon version
description: "The release version number or development commit hash that has the bug."
placeholder: "Version number or commit hash"
validations:
required: true

- type: textarea
attributes:
label: Environment
description: "The environment in which you're running log-surgeon."
placeholder: "OS version, docker version, etc."
validations:
required: true

- type: textarea
attributes:
label: Reproduction steps
description: "List each step required to reproduce the bug."
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Feature/Change Request"
description: Request a feature or change
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Use this form to request a feature/change in the software, or the project as a whole.
- type: textarea
attributes:
label: Request
description: "Describe your request and why it's important."
validations:
required: true

- type: textarea
attributes:
label: Possible implementation
description: "Describe any implementations you have in mind."
validations:
required: true

9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# References
<!-- Any issues or pull requests relevant to this pull request -->

# Description
<!-- Describe what this request will change/fix and provide any details necessary for reviewers -->

# Validation performed
<!-- What tests and validation you performed on the change -->

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
162 changes: 162 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
cmake_minimum_required(VERSION 3.5.1)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

project(log_surgeon
VERSION 0.0.1
DESCRIPTION "log-surgeon: A performant log parsing library"
HOMEPAGE_URL https://github.com/y-scope/log-surgeon
LANGUAGES CXX
)

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(default_build_type "Release")
message(STATUS "No build type specified. Setting to '${default_build_type}'.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
endif()

option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)

set(SOURCE_FILES
src/log_surgeon/Buffer.hpp
src/log_surgeon/BufferParser.cpp
src/log_surgeon/BufferParser.hpp
src/log_surgeon/Constants.hpp
src/log_surgeon/FileReader.cpp
src/log_surgeon/FileReader.hpp
src/log_surgeon/LALR1Parser.cpp
src/log_surgeon/LALR1Parser.hpp
src/log_surgeon/LALR1Parser.tpp
src/log_surgeon/Lexer.hpp
src/log_surgeon/Lexer.tpp
src/log_surgeon/LogEvent.cpp
src/log_surgeon/LogEvent.hpp
src/log_surgeon/LogParser.cpp
src/log_surgeon/LogParser.hpp
src/log_surgeon/LogParserOutputBuffer.cpp
src/log_surgeon/LogParserOutputBuffer.hpp
src/log_surgeon/Parser.tpp
src/log_surgeon/Parser.hpp
src/log_surgeon/ParserInputBuffer.cpp
src/log_surgeon/ParserInputBuffer.hpp
src/log_surgeon/Reader.hpp
src/log_surgeon/ReaderParser.cpp
src/log_surgeon/ReaderParser.hpp
src/log_surgeon/Schema.cpp
src/log_surgeon/Schema.hpp
src/log_surgeon/SchemaParser.cpp
src/log_surgeon/SchemaParser.hpp
src/log_surgeon/Token.cpp
src/log_surgeon/Token.hpp
src/log_surgeon/finite_automata/RegexAST.hpp
src/log_surgeon/finite_automata/RegexAST.tpp
src/log_surgeon/finite_automata/RegexDFA.hpp
src/log_surgeon/finite_automata/RegexDFA.tpp
src/log_surgeon/finite_automata/RegexNFA.hpp
src/log_surgeon/finite_automata/RegexNFA.tpp
src/log_surgeon/finite_automata/UnicodeIntervalTree.hpp
src/log_surgeon/finite_automata/UnicodeIntervalTree.tpp
)

set(LCHIP_INSTALL_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/log_surgeon)
set(LCHIP_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})

add_library(log_surgeon ${SOURCE_FILES})
add_library(log_surgeon::log_surgeon ALIAS log_surgeon)
target_include_directories(log_surgeon
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/log_surgeon>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/log_surgeon
)

target_compile_features(log_surgeon
PRIVATE cxx_std_17
)

target_compile_options(log_surgeon PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
)

# Macro providing the length of the absolute source directory path so we can
# create a relative (rather than absolute) __FILE__ macro
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
target_compile_definitions(log_surgeon
PUBLIC
SOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}
)

# Make off_t 64-bit
target_compile_definitions(log_surgeon
PRIVATE
_FILE_OFFSET_BITS=64
)

install(
TARGETS
log_surgeon
EXPORT
log_surgeon-targets
)

install(
EXPORT
log_surgeon-targets
NAMESPACE
log_surgeon::
DESTINATION
${LCHIP_INSTALL_CONFIG_DIR}
)

install(
DIRECTORY
"${PROJECT_SOURCE_DIR}/src/log_surgeon"
DESTINATION
"${LCHIP_INSTALL_INCLUDE_DIR}"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.tpp"
)

configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/log_surgeon-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/log_surgeon-config.cmake
INSTALL_DESTINATION
${LCHIP_INSTALL_CONFIG_DIR}
PATH_VARS
LCHIP_INSTALL_INCLUDE_DIR
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/log_surgeon-config-version.cmake
COMPATIBILITY
SameMajorVersion
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/log_surgeon-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/log_surgeon-config-version.cmake
DESTINATION
${LCHIP_INSTALL_CONFIG_DIR}
)

# Unit testing
# find_package(Catch2 3 REQUIRED)
set(SOURCE_FILES_unitTest
${SOURCE_FILES}
tests/test-SchemaValidation.cpp
# tests/test-LogParser.cpp
)
# add_executable(unitTest ${SOURCE_FILES_unitTest})
# target_link_libraries(unitTest
# PRIVATE
# Catch2::Catch2WithMain
# )
# target_compile_features(unitTest
# PRIVATE cxx_std_17
# )
Loading

0 comments on commit bec4a26

Please sign in to comment.