internal

package
v2.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/*
	   DatabaseCollection is the name of the MongoDB collection where logs are stored
	*/
	DatabaseCollection string = "logentries"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version              string
	Host                 string `mapstructure:"FIREPLACE_SERVER_HOST"`
	LogLevel             logrus.Level
	Cert                 string `mapstructure:"FIREPLACE_SERVER_CERT"`
	Password             string `mapstructure:"FIREPLACE_SERVER_PASSWORD"`
	PageSize             int    `mapstructure:"FIREPLACE_PAGE_SIZE"`
	DatabaseURL          string `mapstructure:"FIREPLACE_DATABASE_URL"`
	CleanLogIntervalDays int    `mapstructure:"FIREPLACE_CLEAN_LOG_INTERVAL_DAYS"`
	CleanLogSchedule     string `mapstructure:"FIREPLACE_CLEAN_LOG_SCHEDULE"`
}

Config provides configuration information for the Fireplace server

func GetConfig

func GetConfig(version string) Config

GetConfig creates a new configuration object.

type ILogEntryController

type ILogEntryController interface {
	/*
	   CreateLogEntry creates a new log entry and stores it in the database.
	*/
	CreateLogEntry(w http.ResponseWriter, r *http.Request)

	/*
	   DeleteLogEntries deletes all log entries prior to the provided date/time.
	*/
	DeleteLogEntries(w http.ResponseWriter, r *http.Request)

	/*
	   GetApplicationNames returns an array of application names that have written
	   log entries into Fireplace.
	*/
	GetApplicationNames(w http.ResponseWriter, r *http.Request)

	/*
	   GetLogEntries retrieves log entries. A caller may filter results by providing
	   various query parameters.
	*/
	GetLogEntries(w http.ResponseWriter, r *http.Request)

	/*
	   GetLogEntry retrieves a single log entry by ID
	*/
	GetLogEntry(w http.ResponseWriter, r *http.Request)
}

ILogEntryController describes handlers for working with Log Entries in Fireplace Server

type ILogEntryService

type ILogEntryService interface {
	/*
	   CreateLogEntry creates a new log entry in the database
	*/
	CreateLogEntry(entryRequest pkg.CreateLogEntryRequest) (string, error)

	/*
	   GetApplicationNames retrieves a slice of strings that is a list of
	   application names. Every time a client writes a log to Fireplace
	   it provides the name of the application it came from. This result
	   is a unique list of those applications.
	*/
	GetApplicationNames() ([]string, error)

	/*
	   GetLogEntries returns a collection of log entries that match a search criteria.
	*/
	GetLogEntries(filter pkg.LogEntryFilter) (pkg.LogEntryCollection, int, error)

	/*
	   GetLogEntry retrieves a single log entry by ID.
	*/
	GetLogEntry(id string) (pkg.LogEntry, error)

	/*
	   Delete removes log entries that are prior to the provided date/time.
	*/
	Delete(fromDate time.Time) (int, error)
}

ILogEntryService describes methods for working with log entries in Fireplace

type LogEntryController

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

LogEntryController provides handlers for working with Log Entries in Fireplace Server

func NewLogEntryController

func NewLogEntryController(config Config, logger *logrus.Entry, logEntryService ILogEntryService) LogEntryController

NewLogEntryController creates a new LogEntryController

func (LogEntryController) CreateLogEntry

func (c LogEntryController) CreateLogEntry(w http.ResponseWriter, r *http.Request)

CreateLogEntry creates a new log entry and stores it in the database.

func (LogEntryController) DeleteLogEntries

func (c LogEntryController) DeleteLogEntries(w http.ResponseWriter, r *http.Request)

DeleteLogEntries deletes all log entries prior to the provided date/time.

func (LogEntryController) GetApplicationNames

func (c LogEntryController) GetApplicationNames(w http.ResponseWriter, r *http.Request)

GetApplicationNames returns an array of application names that have written log entries into Fireplace.

func (LogEntryController) GetLogEntries

func (c LogEntryController) GetLogEntries(w http.ResponseWriter, r *http.Request)

GetLogEntries retrieves log entries. A caller may filter results by providing various query parameters.

func (LogEntryController) GetLogEntry

func (c LogEntryController) GetLogEntry(w http.ResponseWriter, r *http.Request)

GetLogEntry retrieves a single log entry by ID

type LogEntryService

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

LogEntryService provides methods for working with log entries in Fireplace

func NewLogEntryService

func NewLogEntryService(config Config, db *mongo.Database) LogEntryService

NewLogEntryService creates a new LogEntryService

func (LogEntryService) CreateLogEntry

func (s LogEntryService) CreateLogEntry(entryRequest pkg.CreateLogEntryRequest) (string, error)

CreateLogEntry creates a new log entry in the database

func (LogEntryService) Delete

func (s LogEntryService) Delete(fromDate time.Time) (int, error)

Delete removes log entries that are prior to the provided date/time.

func (LogEntryService) GetApplicationNames

func (s LogEntryService) GetApplicationNames() ([]string, error)

GetApplicationNames retrieves a slice of strings that is a list of application names. Every time a client writes a log to Fireplace it provides the name of the application it came from. This result is a unique list of those applications.

func (LogEntryService) GetLogEntries

func (s LogEntryService) GetLogEntries(filter pkg.LogEntryFilter) (pkg.LogEntryCollection, int, error)

GetLogEntries returns a collection of log entries that match a search criteria.

func (LogEntryService) GetLogEntry

func (s LogEntryService) GetLogEntry(id string) (pkg.LogEntry, error)

GetLogEntry retrieves a single log entry by ID.

Jump to

Keyboard shortcuts

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