services

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEnvironment added in v1.0.1

func CheckEnvironment() bool

checkEnvironment checks the environment and returns a boolean value.

This function does not take any parameters. It returns a boolean value indicating whether the "LOG_GUARDIAN_DATABASE_TYPE" environment variable is set or not.

func Database added in v1.0.1

func Database(priority domain.Priority, tableName string, query string, genericErrMsg string, errMsg string) domain.LogDatabase

database generates a new database log and returns it.

Parameters: - priority: the priority of the log. - tableName: the name of the table to log to. - query: the query to execute. - genericErrMsg: the generic error message. - errMsg: the specific error message.

Returns: - domain.LogDatabase: the generated database log.

func Debug added in v1.0.1

func Debug(priority domain.Priority, genericErrMsg string, errMsg string)

debug prints the provided error message if the priority is set to LOG_DEBUG.

Parameters:

  • priority: the priority level of the error message (domain.Priority)
  • genericErrMsg: the generic error message (string)
  • errMsg: the specific error message (string)

func Details added in v1.0.1

func Details(priority domain.Priority, genericErrMsg string, errMsg string) domain.LogDetails

details generates log details based on the given priority, generic error message, and error message. It calls the Debug function and returns the log details generated by the NewLogDetails function.

Parameters: - priority: the priority level of the log details. - genericErrMsg: the generic error message to be included in the log details. - errMsg: the specific error message to be included in the log details.

Return type: - domain.LogDetails: the log details generated by the NewLogDetails function.

func Function added in v1.0.1

func Function(priority domain.Priority, functionName string, genericErrMsg string, errMsg string) domain.LogFunction

function is a Go function that takes in a priority, functionName, genericErrMsg, and errMsg as parameters.

It calls the Debug function with the provided priority, genericErrMsg, and errMsg arguments. Then it returns a new LogFunction struct by calling the NewFunctionLog function with the provided priority, functionName, genericErrMsg, and errMsg arguments.

func NewDatabaseLog added in v1.0.1

func NewDatabaseLog(priority domain.Priority, tableName string, query string, genericErrMsg string, errMsg string) domain.LogDatabase

NewDatabaseLog creates a new database log entry.

Parameters:

  • priority: the priority of the log entry (domain.Priority).
  • tableName: the name of the table (string).
  • query: the query that was executed (string).
  • genericErrMsg: the generic error message (string).
  • errMsg: the specific error message (string).

Returns:

  • domain.LogDatabase: the created database log entry.

func NewFunctionLog added in v1.0.1

func NewFunctionLog(priority domain.Priority, functionName string, genericErrMsg string, errMsg string) domain.LogFunction

NewFunctionLog creates a new function log with the given priority, function name, generic error message, and error message.

Parameters: - priority: the priority of the log - functionName: the name of the function - genericErrMsg: the generic error message - errMsg: the specific error message

Returns: - a LogFunction struct representing the function log

func NewLogDetails added in v1.0.1

func NewLogDetails(priority domain.Priority, genericErrMsg string, errMsg string) domain.LogDetails

NewLogDetails creates a new instance of the LogDetails struct.

Parameters: - priority: The priority of the log. - genericErrMsg: The generic error message. - errMsg: The specific error message.

Return type: - domain.LogDetails: The newly created LogDetails instance.

func NewRequestLog added in v1.0.1

func NewRequestLog(priority domain.Priority, method string, statusCode int, path string, responseSize int, genericErrMsg string, errMsg string) domain.LogRequest

NewRequestLog creates a new request log with the given parameters.

Parameters: - priority: the priority of the log. - method: the HTTP method of the request. - statusCode: the status code of the response. - path: the path of the request. - responseSize: the size of the response in bytes. - genericErrMsg: a generic error message. - errMsg: a specific error message.

Return type: domain.LogRequest

func Request added in v1.0.1

func Request(priority domain.Priority, method string, statusCode int, path string, responseSize int, genericErrMsg string, errMsg string) domain.LogRequest

request generates a new request log with the provided parameters.

Parameters:

  • priority: The priority of the request.
  • method: The HTTP method of the request.
  • statusCode: The HTTP status code of the response.
  • path: The path of the request.
  • responseSize: The size of the response in bytes.
  • genericErrMsg: The generic error message.
  • errMsg: The specific error message.

Returns:

  • domain.LogRequest: The generated request log.

func SaveLog

func SaveLog(log interface{}) error

SaveLog saves a log to the database.

It takes a log interface{} as a parameter. Returns an error if there was a problem saving the log.

Types

This section is empty.

Jump to

Keyboard shortcuts

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