logging

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

internal/logging/logging.go

Index

Constants

View Source
const (
	// Default log settings if env vars are not set
	DefaultLogDir        = "/tmp/log/nanodns"
	DefaultServiceLog    = "service.log"
	DefaultActionLog     = "actions.log"
	DefaultMaxLogSize    = 10 * 1024 * 1024 // 10MB
	DefaultMaxLogBackups = 5
)

Configuration constants with default values

Variables

This section is empty.

Functions

func Cleanup

func Cleanup()

func CloseServiceLogFile

func CloseServiceLogFile() error

CloseServiceLogFile closes the service log file if it's open

func GetActionLogs

func GetActionLogs(since time.Duration) ([]string, error)

GetActionLogs retrieves action logs with optional filtering

func GetLogPaths

func GetLogPaths() (service, action string)

GetLogPaths returns the current log file paths

func GetServiceLogFile

func GetServiceLogFile() (*os.File, error)

func GetServiceLogs

func GetServiceLogs(since time.Duration) ([]string, error)

GetServiceLogs retrieves service logs with optional filtering

func Init

func Init() error

Init initializes the logging system

func LogAction

func LogAction(action, details string)

LogAction logs administrative actions

func LogService

func LogService(message string)

LogService logs DNS service operations

func RotateLogs

func RotateLogs() error

RotateLogs checks log sizes and rotates if necessary

Types

type Config

type Config struct {
	LogDir         string
	ServiceLogFile string
	ActionLogFile  string
	MaxLogSize     int64
	MaxLogBackups  int
}

Config holds the logging configuration

Jump to

Keyboard shortcuts

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