drasi_reaction_log/lib.rs
1#![allow(unexpected_cfgs)]
2// Copyright 2025 The Drasi Authors.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! Log Reaction Plugin for drasi-lib
17//!
18//! This plugin provides console logging of query results.
19//!
20//! ## Instance-based Usage
21//!
22//! ```rust,ignore
23//! use drasi_reaction_log::LogReaction;
24//! use drasi_lib::config::{ReactionConfig, ReactionSpecificConfig};
25//! use std::sync::Arc;
26//!
27//! // Create configuration
28//! let config = ReactionConfig {
29//! id: "my-log".to_string(),
30//! queries: vec!["query1".to_string()],
31//! config: ReactionSpecificConfig::Log(props),
32//! ..Default::default()
33//! };
34//!
35//! // Create instance and add to DrasiLib
36//! let reaction = Arc::new(LogReaction::new(config, event_tx));
37//! drasi.add_reaction(reaction).await?;
38//! ```
39
40mod config;
41pub mod descriptor;
42mod log;
43
44#[cfg(test)]
45mod tests;
46
47pub use config::{LogReactionConfig, QueryConfig, TemplateSpec};
48pub use log::{LogReaction, LogReactionBuilder};
49
50/// Dynamic plugin entry point (legacy dylib).
51///
52
53/// Dynamic plugin entry point.
54#[cfg(feature = "dynamic-plugin")]
55drasi_plugin_sdk::export_plugin!(
56 plugin_id = "log-reaction",
57 core_version = env!("CARGO_PKG_VERSION"),
58 lib_version = env!("CARGO_PKG_VERSION"),
59 plugin_version = env!("CARGO_PKG_VERSION"),
60 source_descriptors = [],
61 reaction_descriptors = [descriptor::LogReactionDescriptor],
62 bootstrap_descriptors = [],
63);