Skip to content
Merged
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
2 changes: 1 addition & 1 deletion examples/advanced-sqs-partial-batch-failures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ lambda_runtime = "0.7"
tokio = { version = "1", features = ["macros"] }
futures = "0.3"
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }
4 changes: 4 additions & 0 deletions examples/advanced-sqs-partial-batch-failures/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ async fn data_handler(data: Data) -> Result<(), Error> {
/// Main function for the lambda executable.
#[tokio::main]
async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-error-handling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ serde_json = "1.0.81"
simple-error = "0.2.3"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/basic-error-handling/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ impl std::fmt::Display for CustomError {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ lambda_runtime = { path = "../../lambda-runtime" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }
6 changes: 6 additions & 0 deletions examples/basic-lambda/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ struct Response {

#[tokio::main]
async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-shared-resource/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda_runtime = { path = "../../lambda-runtime" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


5 changes: 5 additions & 0 deletions examples/basic-shared-resource/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-sqs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ lambda_runtime = { path = "../../lambda-runtime" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }
4 changes: 4 additions & 0 deletions examples/basic-sqs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ async fn function_handler(event: LambdaEvent<SqsEventObj<Data>>) -> Result<(), E

#[tokio::main]
async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-basic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ async fn my_extension(event: LambdaEvent) -> Result<(), Error> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-combined/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-combined/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ async fn my_log_processor(logs: Vec<LambdaLog>) -> Result<(), Error> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-custom-events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-custom-events/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ async fn my_extension(event: LambdaEvent) -> Result<(), Error> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-custom-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-custom-service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ impl Service<LambdaEvent> for MyExtension {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-logs-basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros", "rt"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-logs-basic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ async fn handler(logs: Vec<LambdaLog>) -> Result<(), Error> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-logs-custom-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-logs-custom-service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ impl Service<Vec<LambdaLog>> for MyLogsProcessor {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 2 additions & 0 deletions examples/extension-logs-kinesis-firehose/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ edition = "2021"
[dependencies]
lambda-extension = { path = "../../lambda-extension" }
tokio = { version = "1.17.0", features = ["full"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }
aws-config = "0.13.0"
aws-sdk-firehose = "0.13.0"

12 changes: 12 additions & 0 deletions examples/extension-logs-kinesis-firehose/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ impl Service<Vec<LambdaLog>> for FirehoseLogsProcessor {

#[tokio::main]
async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();

let config = aws_config::load_from_env().await;
let logs_processor = SharedService::new(FirehoseLogsProcessor::new(Client::new(&config)));

Expand Down
2 changes: 1 addition & 1 deletion examples/extension-telemetry-basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda-extension = { path = "../../lambda-extension" }
serde = "1.0.136"
tokio = { version = "1", features = ["macros", "rt"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/extension-telemetry-basic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ async fn handler(events: Vec<LambdaTelemetry>) -> Result<(), Error> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/http-axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lambda_http = { path = "../../lambda-http" }
lambda_runtime = { path = "../../lambda-runtime" }
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }

axum = "0.6.4"
serde_json = "1.0"
6 changes: 6 additions & 0 deletions examples/http-axum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ async fn post_foo_name(Path(name): Path<String>) -> Json<Value> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/http-basic-lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ lambda_http = { path = "../../lambda-http" }
lambda_runtime = { path = "../../lambda-runtime" }
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


6 changes: 6 additions & 0 deletions examples/http-basic-lambda/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ async fn function_handler(_event: Request) -> Result<Response<Body>, Error> {

#[tokio::main]
async fn main() -> Result<(), Error> {
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
2 changes: 1 addition & 1 deletion examples/http-cors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ lambda_runtime = { path = "../../lambda-runtime" }
tokio = { version = "1", features = ["macros"] }
tower-http = { version = "0.3.3", features = ["cors"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


8 changes: 6 additions & 2 deletions examples/http-cors/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ use tower_http::cors::{Any, CorsLayer};

#[tokio::main]
async fn main() -> Result<(), Error> {
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
// required to enable CloudWatch error logging by the runtime
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disable printing the name of the module in every log line.
.with_target(false)
// this needs to be set to false, otherwise ANSI color codes will
// show up in a confusing manner in CloudWatch logs.
.with_ansi(false)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
Expand Down
4 changes: 2 additions & 2 deletions examples/http-dynamodb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ lambda_runtime = { path = "../../lambda-runtime" }
aws-sdk-dynamodb = "0.21.0"
aws-config = "0.51.0"
tokio = { version = "1", features = ["macros"] }
tracing = { version = "0.1.37"}
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "fmt"] }


Loading