grow_aws_cloudwatch_logs/lib.rs
1// Service-owned (created from the sdk-kit 0.1.0 skeleton).
2//! # grow-aws-cloudwatch-logs
3//!
4//! Rust SDK for [Amazon CloudWatch Logs](https://grow-codes-packages.github.io/aws-cloudwatch-logs/)
5//! by Grow Codes, built on the official AWS SDK for Rust (`aws-sdk-cloudwatchlogs`).
6//!
7//! ```no_run
8//! # async fn demo() -> grow_aws_cloudwatch_logs::Result<()> {
9//! use grow_aws_cloudwatch_logs::logging::{attrs, LogClient, LogQueryClient, SearchOptions};
10//! use grow_aws_cloudwatch_logs::{
11//! CloudWatchLogsClient, CloudWatchLogsConfig, EnsureLogGroupOptions, LogClientOptions,
12//! LogEvent, PutLogEventsOptions,
13//! };
14//!
15//! let client = CloudWatchLogsClient::new(CloudWatchLogsConfig::from_env()?)?;
16//! client
17//! .ensure_log_group("app/web", EnsureLogGroupOptions::default().retention_days(14))
18//! .await?;
19//! client
20//! .put_log_events("app/web", "web-1", vec![LogEvent::new("hello")], PutLogEventsOptions::default())
21//! .await?;
22//!
23//! // Logging category: batching LogClient + Logger facade, and search.
24//! let logs = client.log_client(LogClientOptions::default())?;
25//! logs.logger(Some("http"), attrs! {}).info("listening", attrs! { "port" => 8080 });
26//! logs.flush(None).await?;
27//! let found = client.log_query_client(None)?.search("listening", SearchOptions::default()).await?;
28//! println!("{} records", found.records.len());
29//! client.close().await;
30//! # Ok(())
31//! # }
32//! ```
33//!
34//! Features: `blocking` (a blocking client), `testing` (in-memory fakes and the conformance
35//! runner), `tracing-layer` and `log-bridge` (logging adapters, on by default).
36//!
37//! Not affiliated with or endorsed by Amazon Web Services. Amazon CloudWatch and AWS are
38//! trademarks of Amazon.com, Inc. or its affiliates.
39#![cfg_attr(docsrs, feature(doc_cfg))]
40
41pub mod core;
42
43mod aws_error;
44mod client;
45mod config;
46mod emf;
47mod groups;
48mod ingest;
49mod livetail;
50mod logs;
51mod models;
52mod paginator;
53mod query;
54mod sdk;
55
56#[cfg(feature = "blocking")]
57#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
58pub mod blocking;
59
60#[cfg(feature = "testing")]
61#[cfg_attr(docsrs, doc(cfg(feature = "testing")))]
62pub mod testing;
63
64pub mod logging;
65
66pub use crate::core::{Error, ErrorCode, HealthStatus, Result, RetryPolicy, Secret};
67
68pub use crate::aws_error::{
69 aws_error_code, error_code_for_aws, error_code_from_body, AwsErrorDetail, AWS_ERROR_CODES,
70};
71pub use crate::client::{partition_of, CloudWatchLogsClient};
72pub use crate::config::{
73 CloudWatchLogsConfig, CloudWatchLogsConfigBuilder, OversizePolicy, API_VERSION,
74 DEFAULT_MAX_EVENT_BYTES, DEFAULT_ROLE_SESSION_NAME, DEFAULT_URL, MAX_EVENT_BYTES_LIMIT,
75 VENDOR_LOG_GROUP_VARS, VENDOR_LOG_STREAM_VARS, VENDOR_PROFILE_VARS, VENDOR_REGION_VARS,
76 VENDOR_URL_VARS,
77};
78pub use crate::emf::{build_emf, EmfOptions, DEFAULT_EMF_NAMESPACE, EMF_UNITS};
79pub use crate::ingest::truncate_message;
80pub use crate::livetail::LiveTailSession;
81pub use crate::logs::{
82 filter_pattern, filtered_event_to_record, live_tail_event_to_record, message_to_record,
83 CloudWatchLogsExporter, CloudWatchLogsQueryClient, ExporterOptions, LogClientOptions,
84};
85pub use crate::models::*;
86pub use crate::paginator::Paginator;
87pub use crate::query::parse_query_timestamp;
88
89/// The AWS SDK for Rust crate this package is built on (for `with_sdk_client` and the escape
90/// hatch [`CloudWatchLogsClient::sdk`]).
91pub use aws_sdk_cloudwatchlogs;
92
93/// Service-prefixed alias of [`Error`].
94pub type CloudWatchLogsError = Error;