Lambda Structured Logger

A simple opinionated structured logger for AWS Lambda

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.sailes
Идентификатор

Идентификатор

lambda-structured-logger
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Lambda Structured Logger
A simple opinionated structured logger for AWS Lambda
Ссылка на сайт

Ссылка на сайт

https://github.com/marksailes/lambda-structured-logger
Система контроля версий

Система контроля версий

https://github.com/marksailes/lambda-structured-logger/tree/master

Скачать lambda-structured-logger

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.sailes/lambda-structured-logger/ -->
<dependency>
    <groupId>net.sailes</groupId>
    <artifactId>lambda-structured-logger</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.sailes/lambda-structured-logger/
implementation 'net.sailes:lambda-structured-logger:0.2.0'
// https://jarcasting.com/artifacts/net.sailes/lambda-structured-logger/
implementation ("net.sailes:lambda-structured-logger:0.2.0")
'net.sailes:lambda-structured-logger:jar:0.2.0'
<dependency org="net.sailes" name="lambda-structured-logger" rev="0.2.0">
  <artifact name="lambda-structured-logger" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.sailes', module='lambda-structured-logger', version='0.2.0')
)
libraryDependencies += "net.sailes" % "lambda-structured-logger" % "0.2.0"
[net.sailes/lambda-structured-logger "0.2.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.amazonaws : aws-lambda-java-core jar 1.2.1
com.fasterxml.jackson.core : jackson-databind jar 2.11.0

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.12

test (3)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.6.2
org.junit.jupiter : junit-jupiter-engine jar 5.6.2
org.mockito : mockito-core jar 3.3.3

Модули Проекта

Данный проект не имеет модулей.

Java CI with Maven Maven Central

Lambda Structured Logger

A simple opinionated structured logger for AWS Lambda

Purpose

To provide a simple and easy to use structured logger specifically for use with AWS Lambda.

Example Usage

The following example usage:

import net.sailes.lambda.logger.Logger;
import net.sailes.lambda.logger.LoggerFactory;

public class PaymentHandler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
    
    public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent event, Context context) {
        Logger logger = LoggerFactory.getLogger();        
        logger.addContextKeys(context);
        logger.info("Collecting Payment");
        ...
    }
}

Produces a single line JSON formatted output (displayed in multi-line for readability)

{
   "timestamp":"2020-08-09T11:52:34.290Z",
   "service":"Payment Service",
   "message":"Collecting Payment",
   "coldStart":true,
   "functionName":"example-HelloWorldFunction-1P1Z6B39FLU73",
   "functionVersion":"1.0.0",
   "functionArn":"arn:aws:lambda:eu-west-1:012345678910:function:example-HelloWorldFunction-1P1Z6B39FLU73",
   "functionMemorySize":512,
   "functionRequestId":"899856cb-83d1-40d7-8611-9e78f15f32f4"
}

Maven

<dependency>
  <groupId>net.sailes</groupId>
  <artifactId>lambda-structured-logger</artifactId>
  <version>0.2.0</version>
</dependency>

Cold Start Tracking

To use the cold start tracking functionality please use the LoggerFactory.getLogger() method.

Additional Configuration

Environment Variables

Name Description Default
SERVICE_NAME Friendly name for your function service_undefined

Версии библиотеки

Версия
0.2.0
0.1.0