transactionlog

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 3 Imported by: 0

README

Transaction log package

This is a package for transaction logging.

Usage

Here is an example of how to use this package. Start with creating a package in internal/logging and add a file logging.go with the following content:

package logging

import translog "github.com/mariusfa/gofl/v2/logging/trans-log"

var TransLogger *translog.TransLogger

func SetupTransLogger(appName string) {
	TransLogger = translog.NewTransLogger(appName)
}

In the main.go file, you can use the logger like this:

package main

import (
	"<my-module>/internal/logging"

	"github.com/mariusfa/gofl/v2/config"
)

func main() {
	logging.SetupTransLogger("<my-module>")
	transLogger := logging.TransLogger

    // ... rest of the code
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestInfo

func RequestInfo(requestId string, requestMethod string, requestPath string, requestBody string, userId string)

func ResponseInfo

func ResponseInfo(requestId string, durationMs string, status int, responseBody string, userId string)

func SetAppName

func SetAppName(appName string)

Types

type TransLogger

type TransLogger struct {
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger() *TransLogger

func NewTransLogger

func NewTransLogger(appName string) *TransLogger

func (*TransLogger) RequestInfo

func (al *TransLogger) RequestInfo(requestId string, requestMethod string, requestPath string, requestBody string, userId string)

func (*TransLogger) ResponseInfo

func (al *TransLogger) ResponseInfo(requestId string, durationMs string, status int, responseBody string, userId string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL