Skip to content

Commit

Permalink
Merge pull request #15 from imperva/eas/hierarchecal
Browse files Browse the repository at this point in the history
Eas/hierarchecal
  • Loading branch information
gadunga authored Nov 28, 2023
2 parents 0691c53 + 57c08c9 commit bf3cbac
Show file tree
Hide file tree
Showing 32 changed files with 733 additions and 688 deletions.
29 changes: 0 additions & 29 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,2 @@
[net]
git-fetch-with-cli = true

[target.'cfg(all())']
rustflags = [
"-Wclippy::all", # correctness, sus, style, complexity, perf
"-Wclippy::pedantic",
"-Wclippy::cargo",
"-Wclippy::restriction",
"-Aclippy::missing_docs_in_private_items", # pub docs should be fine
"-Aclippy::as_conversions", # not-recommended, covered by other lints
"-Aclippy::missing_inline_in_public_items", # we're using lto, so obviated
"-Aclippy::cargo_common_metadata", # these are internal crates
"-Aclippy::exhaustive_structs", # ..
"-Aclippy::exhaustive_enums", # ..
"-Aclippy::implicit_return", # non-std style
"-Aclippy::else-if-without-else", # ..
"-Aclippy::self-named-module-files", # ..
"-Aclippy::default_trait_access", # ..
"-Aclippy::pattern_type_mismatch", # ..
"-Aclippy::mod_module_files", # ..
"-Aclippy::if_then_some_else_none", # ..
"-Aclippy::str_to_string", # rustc suggests `.to_string()`, so non-std style
"-Aclippy::shadow_reuse", # I feel this can actually be great
"-Aclippy::multiple_crate_versions", # This isnt something we have much control over
"-Aclippy::must_use_candidate", # really noisy
"-Aclippy::default_numeric_fallback", # should be allowed with '0'.
"-Aclippy::module_name_repetitions", # I found this impractical
"-Aclippy::implicit_hasher", # Adds a lot of complication only a bit of generalization
"-Aclippy::pub_use",
]
54 changes: 27 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ jobs:
strategy:
matrix:
toolchain:
- nightly-2022-06-25
- nightly-2023-10-25
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: "clippy, rustfmt"

- name: Update local toolchain
- name: Info
run: |
rustup update ${{ matrix.toolchain }}
rustup default ${{ matrix.toolchain }}
rustup +${{ matrix.toolchain }} component add clippy rustfmt
- name: Toolchain info
run: |
cargo +${{ matrix.toolchain }} --version --verbose
cargo +${{ matrix.toolchain }} clippy --version
cargo +${{ matrix.toolchain }} fmt --version
rustc --version
cargo --version --verbose
cargo clippy --version
cargo fmt --version
- name: Lint
run: |
cargo +${{ matrix.toolchain }} fmt -- --check
cargo +${{ matrix.toolchain }} clippy -- -D warnings
cargo fmt -- --check
cargo clippy -- -D warnings
cargo:
name: Build & Test
Expand All @@ -51,27 +51,27 @@ jobs:
- stable
- beta
- nightly
- nightly-2022-06-25
- nightly-2023-10-25
steps:
- uses: actions/checkout@v3

- name: Update local toolchain
run: |
rustup update ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: taiki-e/install-action@nextest

- name: Toolchain info
- name: Info
run: |
cargo +${{ matrix.toolchain }} --version --verbose
rustc +${{ matrix.toolchain }} --version
cargo --version --verbose
rustc --version
- name: Test
run: |
cargo +${{ matrix.toolchain }} check
cargo +${{ matrix.toolchain }} test --all ${{ matrix.features_arg }}
cargo check
cargo nextest run --all ${{ matrix.features_arg }}
- name: Build
run: |
cargo +${{ matrix.toolchain }} build ${{ matrix.features_arg }} --release
cargo build --release ${{ matrix.features_arg }}
benchmark:
name: Run benchmarks
Expand All @@ -83,7 +83,7 @@ jobs:
BENCHER_VERSION: 0.2.27
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install
run: |
rustup update
Expand Down
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"cSpell.words": [
"fmtorp",
"messageonly"
]
"rust-analyzer.rustfmt.extraArgs": [
"+nightly"
],
}
107 changes: 107 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,109 @@
cargo-features = ["workspace-inheritance"]

[workspace]
resolver = "2"
members = ["trace4rs", "trace4rs-config", "trace4rs-fmtorp"]

[workspace.package]
version = "0.5.1"
authors = [
"Evan Simmons <[email protected]>",
"Everett Pompeii <[email protected]>",
"Richard Meester <[email protected]>",
]
edition = "2021"
license = "MIT"
keywords = ["tracing", "logging", "log4rs"]
repository = "https://github.com/imperva/trace4rs"
readme = "readme.md"
categories = ["development-tools"]

[profile.dev]
opt-level = 1
[profile.dev.package."*"]
opt-level = 3

[workspace.dependencies]
literally = "0.1.3"
log = "0.4.14"
once_cell = "1.8.0"
parking_lot = "0.12.0"
regex = "1.5.4"
thiserror = "1.0.29"
tracing = "0.1.0"
tracing-subscriber = { version = "0.3", features = [
"std",
"fmt",
"time",
"local-time",
"registry",
] }
tracing-log = "0.2"
time = { version = "0.3", features = ["formatting", "macros"] }
path-absolutize = "3.0.11"
trace4rs-config = { version = "*", path = "trace4rs-config" }
trace4rs-fmtorp = { version = "*", path = "trace4rs-fmtorp" }
utc-offset = "0.4.0"
camino = "1.1.2"
tracing-span-tree = { git = "https://github.com/estk/tracing-span-tree" }
criterion = "0.5.0"
criterion-macro = "0.4.0"
log4rs = "1.0.0"
serde = "1.0.130"
serde_json = "1.0.68"
tempfile = "3.2.0"
tokio = { version = "1.13.0", features = [
"rt",
"rt-multi-thread",
"macros",
"time",
"fs",
] }

[workspace.lints.clippy]
all = "warn"
pedantic = "warn"
cargo = "warn"
module_name_repetitions = { priority = 1, level = "allow" }
assertions_on_result_states = "warn"
arithmetic_side_effects = "warn"
create_dir = "warn"
deref_by_slicing = "warn"
empty_drop = "warn"
empty_structs_with_brackets = "warn"
filetype_is_file = "warn"
format_push_string = "warn"
indexing_slicing = "warn"
lossy_float_literal = "warn"
mem_forget = "warn" # Use ManuallyDrop
missing_assert_message = "warn"
missing_asserts_for_indexing = "warn"
multiple_inherent_impl = "warn"
mutex_atomic = "warn"
needless_raw_strings = "warn"
panic_in_result_fn = "warn"
partial_pub_fields = "warn"
pub_without_shorthand = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
redundant_type_annotations = "warn"
self_named_module_files = "warn"
semicolon_outside_block = "warn"
shadow_unrelated = "warn"
string_lit_chars_any = "warn"
string_slice = "warn"
tests_outside_test_module = "warn"
undocumented_unsafe_blocks = "warn"
unnecessary_self_imports = "warn"
unneeded_field_pattern = "warn"
unseparated_literal_suffix = "warn"
unwrap_in_result = "warn"
unwrap_used = "warn"
verbose_file_reads = "warn"

# Enable when stabilized
# allow_attributes = "warn"
# allow_attributes_without_reason = "warn"

# Unsure of
# absolute_paths = "warn"
46 changes: 46 additions & 0 deletions cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
allowCompoundWords: true
languageSettings:
- languageId: rust
ignoreRegExpList:
- rust-string_binary
- rust-string_raw
- rust-string
patterns:
- name: rust-string
pattern: /(")[^\1]*?\1/g
- name: rust-string-binary
pattern: /\bbr?(").*?\1/gi
- name: rust-string-raw
pattern: /\bu?r#(").*?\1#/gi
dictionaries:
- rust
- cpp
- c
- bash
- python
ignorePaths:
- Cargo.lock
- target
minWordLength: 5
userWords:
- appender
- appenders
- fmtorp
- fmtr
- fmtstr
- hmap
- hset
- Lyrd
- messageonly
- schemars
- strt
- targ
- thiserror
- strat
- replacen
- stabilized
- Meester
- unseparated
- dtolnay
- rustc
- taiki
11 changes: 11 additions & 0 deletions README.md → readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ The takeaway is that the actual appenders are roughly equivalent in
performance. However, when using the `tracing` macros vs the `log` macros
the appender performance is roughly 2 orders of magnitude larger.
See for yourself with `cargo bench --features tracing-macros`

## Dev suggestions

- `cargo install cargo-binstall`
- `cargo install cargo-nextest`

## Todo

- verify cspell working
- add an example for metrics functionality in lieu of a pub method
- remove custom_test_frameworks usage
3 changes: 0 additions & 3 deletions rust-toolchain.toml

This file was deleted.

2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use_field_init_shorthand = true
use_try_shorthand = true
match_block_trailing_comma = true

# Nightly options -- once stablilized these will likely get a default of true
# Nightly options -- once stabilized these will likely get a default of true
enum_discrim_align_threshold = 10
format_code_in_doc_comments = true
# format_generated_files = true
Expand Down
27 changes: 16 additions & 11 deletions trace4rs-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
[package]
name = "trace4rs-config"
version = "0.5.1"
edition = "2021"
description = "trace4rs configuration"
keywords = ["tracing", "logging", "log4rs"]
authors = ["Evan Simmons", "Everett Pompeii", "Richard Meester"]
license = "MIT"
version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
keywords.workspace = true
repository.workspace = true
readme.workspace = true
categories.workspace = true

[lints]
workspace = true

[features]
in-order-serialization = ["serde"]

[dependencies]
literally = "0.1.3"
literally.workspace = true
thiserror.workspace = true
tracing.workspace = true
serde = { workspace = true, optional = true, features = ["derive"] }
schemars = { version = "0.8.3", optional = true }
serde = { version = "1.0.130", optional = true, features = ["derive"] }
smart-default = "0.6.0"
thiserror = "1.0.29"
tracing = "0.1.0"

[dev-dependencies]
serde_json = "1.0.89"
serde_json.workspace = true
Loading

0 comments on commit bf3cbac

Please sign in to comment.