loginfo

package
v0.11.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 17 Imported by: 10

Documentation

Overview

Package loginfo tracks changes to objects when they're saved, noting the actor performing the action, what kind of action it was, the time of the change, the type of object and its id, and a dump of the object's state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesExist added in v0.11.4

func DoesExist(eventID string) (bool, util.Gerror)

DoesExist checks if the particular event in question exists. To be compatible with the interface for HEAD responses, this method receives a string rather than an integer.

func Import

func Import(logData map[string]interface{}) error

Import a log info event from an export dump.

func LogEvent

func LogEvent(doer actor.Actor, obj util.GoiardiObj, action string) error

LogEvent writes an event of the action type, performed by the given actor, against the given object.

func PurgeLogInfos

func PurgeLogInfos(id int) (int64, error)

PurgeLogInfos removes all logged events before the given id.

Types

type LogInfo

type LogInfo struct {
	Actor        actor.Actor `json:"-"`
	ActorInfo    string      `json:"actor_info"`
	ActorType    string      `json:"actor_type"`
	Time         time.Time   `json:"time"`
	Action       string      `json:"action"`
	ObjectType   string      `json:"object_type"`
	ObjectName   string      `json:"object_name"`
	ExtendedInfo string      `json:"extended_info"`
	ID           int         `json:"id"`
}

LogInfo holds log information about events.

func AllLogInfos

func AllLogInfos() []*LogInfo

AllLogInfos returns a list of all logged events in the database. Provides a wrapper around GetLogInfos() for consistency with the other object types for exporting data.

func Get

func Get(id int) (*LogInfo, error)

Get a particular event by its id.

func GetLogInfos

func GetLogInfos(searchParams map[string]string, limits ...int) ([]*LogInfo, error)

GetLogInfos gets a slice of the logged events. May be called with an offset and limit, (in that order) but that is not required. The offset can be specified without a limit, but a limit requires an offset (which can be 0). The map of search params may be nil, but something must be present.

func (*LogInfo) Delete

func (le *LogInfo) Delete() error

Delete a logged event.

Jump to

Keyboard shortcuts

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