securitylog

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package securitylog 安全日志

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(mod string, db *orm.DB)

Types

type Log

type Log struct {
	// 展示数据不给 ID,自增 ID 会暴露一些不必要的信息。
	Content   string    `json:"content" xml:",cdata"`
	IP        string    `json:"ip" xml:"ip,attr"`
	UserAgent string    `json:"ua" xml:"ua"`
	Created   time.Time `xml:"created" json:"created"`
}

type Logs

type Logs struct {
	Count int64  `json:"count" xml:"count,attr"`
	Logs  []*Log `json:"logs" xml:"log"`
}

type SecurityLog

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

SecurityLog 安全日志

安全日志是以用户类型为区分的日志对象, 用于记录用户的一些比较重要的操作记录。

func New

func New(mod string, db *orm.DB) *SecurityLog

func (*SecurityLog) Add

func (l *SecurityLog) Add(uid int64, ip, ua, content string) error

Add 添加一条记录

func (*SecurityLog) AddWithContext

func (l *SecurityLog) AddWithContext(uid int64, ctx *web.Context, content string) error

func (*SecurityLog) Get

func (l *SecurityLog) Get(uid int64, size, page int, txt string, start, end time.Time) (*Logs, error)

Get 获取与 uid 关联的安全日志信息

func (*SecurityLog) GetHandle

func (l *SecurityLog) GetHandle(uid int64, ctx *web.Context) web.Responser

GetHandle 将数据以固定的格式输出客户端

Jump to

Keyboard shortcuts

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