Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ members = [
]

[workspace.package]
version = "0.34.0"
version = "0.35.0-alpha.1"
edition = "2024"
repository = "https://github.com/pamburus/hl"
license = "MIT"
Expand Down Expand Up @@ -76,6 +76,7 @@ known-folders = "1"
log = "0.4"
logos = "0.16"
memchr = "2"
mline = { path = "./crate/mline" }
nonzero_ext = "0.3"
notify = { version = "8", features = ["macos_kqueue"] }
num_cpus = "1"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ Output Options:
-E, --show-empty-fields Show empty fields, overrides --hide-empty-fields option [env: HL_SHOW_EMPTY_FIELDS=]
--input-info <LAYOUTS> Input number and filename layouts [default: auto] [possible values: auto, none, minimal, compact, full]
--ascii [<WHEN>] Whether to restrict punctuation to ASCII characters only [env: HL_ASCII=] [default: auto] [possible values: auto, never, always]
-x, --expansion <MODE> Whether to expand fields and messages [env: HL_EXPANSION=] [default: medium] [possible values: never, inline, low, medium, high, always]
-o, --output <FILE> Output file

Input Options:
Expand Down
22 changes: 14 additions & 8 deletions benches/bench/ws/hl/combined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,30 @@ use hl::{
DateTimeFormatter, Filter, LinuxDateFormat, Parser, ParserSettings, SegmentProcessor, Settings, Theme,
app::{RecordIgnorer, SegmentProcess, SegmentProcessorOptions},
formatting::{NoOpRecordWithSourceFormatter, RecordFormatterBuilder},
settings,
settings::{self, ExpansionMode},
timezone::Tz,
};

const GROUP: &str = strcat!(super::GROUP, ND, "combined");

const THEME: &str = "universal";
const SAMPLES: [(&str, &[u8]); 4] = [
("json", samples::log::elk01::JSON),
("logfmt", samples::log::elk01::LOGFMT),
("json", samples::log::int01::JSON),
("logfmt", samples::log::int01::LOGFMT),
const SAMPLES: [(&str, &[u8], ExpansionMode); 6] = [
("json", samples::log::elk01::JSON, ExpansionMode::Inline),
("logfmt", samples::log::elk01::LOGFMT, ExpansionMode::Inline),
("json", samples::log::elk01::JSON, ExpansionMode::Always),
("logfmt", samples::log::elk01::LOGFMT, ExpansionMode::Always),
("json", samples::log::int01::JSON, ExpansionMode::Inline),
("logfmt", samples::log::int01::LOGFMT, ExpansionMode::Inline),
];

pub(super) fn bench(c: &mut Criterion) {
let mut c = c.benchmark_group(GROUP);

for (format, input) in SAMPLES {
let param = format!("{}:{}:{}", format, input.len(), hash(input));
for (format, input, expansion) in SAMPLES {
let mut param = format!("{}:{}:{}", format, input.len(), hash(input));
if expansion != ExpansionMode::Inline {
param = format!("{}:x={}", param, expansion);
}

c.throughput(Throughput::Bytes(input.len() as u64));

Expand All @@ -43,6 +48,7 @@ pub(super) fn bench(c: &mut Criterion) {
LinuxDateFormat::new("%b %d %T.%3N").compile(),
Tz::FixedOffset(Utc.fix()),
))
.with_expansion(expansion.into())
.with_options(settings::Formatting::default())
.build();

Expand Down
2 changes: 2 additions & 0 deletions crate/encstr/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ impl fmt::Display for Error {
}
}

impl std::error::Error for Error {}

#[cfg(test)]
mod tests;
1 change: 1 addition & 0 deletions crate/heapopt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
1 change: 1 addition & 0 deletions crate/heapopt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "heapopt"
version = "0.1.1"
edition.workspace = true
description = "Optimized collections for minimal heap usage"
repository.workspace = true
license.workspace = true

Expand Down
11 changes: 11 additions & 0 deletions crate/heapopt/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ impl<T, const N: usize> Vec<T, N> {
v
}

/// Creates a new vector from the given slice.
#[inline]
#[allow(clippy::should_implement_trait)]
pub fn from_iter<I: IntoIterator<Item = T>>(src: I) -> Self {
let mut iter = src.into_iter();
Self {
head: heapless::Vec::from_iter(iter.by_ref().take(N)),
tail: std::vec::Vec::from_iter(iter),
}
}

/// Returns the number of elements in the vector.
#[inline]
pub fn len(&self) -> usize {
Expand Down
1 change: 1 addition & 0 deletions crate/mline/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
12 changes: 12 additions & 0 deletions crate/mline/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "mline"
version = "0.1.0"
edition.workspace = true
description = "Multi-line string manipulation library for Rust"
repository.workspace = true
license.workspace = true
workspace = "../.."

[dependencies]
heapopt = { path = "../heapopt" }
itertools = "0.13"
Loading
Loading