1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! <p align="center">
//! <a href="https://github.com/bensadeh/tailspin">
//! <img src="https://raw.githubusercontent.com/bensadeh/tailspin/main/assets/tailspin.png" alt="tailspin logo" width="250" />
//! </a>
//! </p>
//!
//! #
//!
//! `tailspin` is a log file highlighter. This crate exposes the [`Highlighter`] type,
//! allowing you to programmatically apply the same pattern-driven highlighting used by the CLI.
//!
//! In order to configure the highlighter, use the [`HighlighterBuilder`]. Otherwise, use
//! [`Highlighter::default()`](crate::Highlighter::default) for reasonable defaults.
//!
//! ## Dependency usage
//!
//! When using `tailspin` as a library, disable default features to avoid pulling in
//! CLI-specific dependencies like `tokio`, `clap`, and `rayon`:
//!
//! ```toml
//! [dependencies]
//! tailspin = { version = "6.0", default-features = false }
//! ```
//!
//!
//! ## Example
//!
//! ```rust
//! use tailspin::config::*;
//! use tailspin::Highlighter;
//! use tailspin::style::{Color, Style};
//!
//! let highlighter = Highlighter::builder()
//! .with_number_highlighter(NumberConfig {
//! style: Style {
//! fg: Some(Color::Cyan),
//! ..Style::default()
//! },
//! })
//! .with_quote_highlighter(QuoteConfig {
//! quote_token: b'"',
//! style: Style {
//! fg: Some(Color::Yellow),
//! ..Style::default()
//! },
//! })
//! .with_uuid_highlighter(UuidConfig::default())
//! .build()
//! .expect("Failed to build highlighter");
//!
//! let input = "Hello 42 world";
//! let output = highlighter.apply(input);
//!
//! // "\x1b[36m" = ANSI cyan start, "\x1b[0m" = reset
//! assert_eq!(output, "Hello \x1b[36m42\x1b[0m world");
//! ```
pub use ;
/// Configuration support for custom highlighting themes and regex rules.
/// ANSI style and color definitions for highlighted output.