core

package
v0.0.0-...-cc171e2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OUT          = 0
	ERR          = 1
	GLOBAL_ERR   = 2
	CLIENT_CLOSE = 3
	FLASH        = 4
	FILE_INFO    = 5
	FOLLOW       = 6
)
View Source
const LOG_NAME = "[LogServer] "

Variables

View Source
var Log = logging.MustGetLogger(LOG_NAME)

Functions

func DefaultFileProvider

func DefaultFileProvider(srv *LogServer, filename string, file *File) (err error)

func InitLog

func InitLog(level logging.Level) *logging.Logger

func ParseConfigValue

func ParseConfigValue(dest interface{}, value interface{},
	parse func(value string) (interface{}, error)) (interface{}, error)

func SampleConfig

func SampleConfig() string

Types

type Client

type Client struct {
	Sender       *Sender
	Id           int
	Fc           *FileFollowChan
	Closed       bool
	TimeOut      <-chan time.Time
	CloseTimeOut <-chan time.Time
	// contains filtered or unexported fields
}

func (*Client) Exists

func (client *Client) Exists() bool

func (*Client) Remove

func (client *Client) Remove()

func (*Client) RenewTimeout

func (client *Client) RenewTimeout()

func (*Client) Send

func (client *Client) Send(t int, data interface{})

type File

type File struct {
	Key  string
	Info string

	OutPath              string
	ErrPath              string
	OutKey               string
	ErrKey               string
	Written              *util.IsWritenResult
	FollowRequireWritten bool
	// contains filtered or unexported fields
}

func DefaultRequestFileProvider

func DefaultRequestFileProvider(files *Files, ctx *macaron.Context, filename string) (*File, error)

func (*File) Cat

func (file *File) Cat(sender *Sender)

func (*File) CheckFollow

func (file *File) CheckFollow() (follow bool, err error)

func (*File) Follow

func (file *File) Follow() bool

type FileFollowChan

type FileFollowChan struct {
	Files          *Files
	File           *File
	LastId         int
	Chan           chan string
	Clients        map[int]*Client
	LastTailId     int
	Follow         *Follow
	ClientsMonitor []chan bool
}

func (*FileFollowChan) ClientMonitor

func (fc *FileFollowChan) ClientMonitor() chan bool

func (*FileFollowChan) IsWritten

func (fc *FileFollowChan) IsWritten() bool

func (*FileFollowChan) Send

func (fc *FileFollowChan) Send(t int, line interface{})

func (*FileFollowChan) Start

func (fc *FileFollowChan) Start()

type Files

type Files struct {
	Server *LogServer
	Files  map[string]*FileFollowChan
	Timer  chan bool
}

func (*Files) AddClient

func (f *Files) AddClient(file *File, client *Client) *Client

func (*Files) GetFile

func (files *Files) GetFile(key string) (*File, error)

func (*Files) Start

func (files *Files) Start()

type Follow

type Follow struct {
	Fc        *FileFollowChan
	Id        int
	Running   int
	KillChans []chan bool
}

func (*Follow) IsRunning

func (f *Follow) IsRunning() bool

func (*Follow) Kill

func (f *Follow) Kill()

func (*Follow) KillMonitor

func (f *Follow) KillMonitor() chan bool

func (*Follow) Start

func (f *Follow) Start()

func (*Follow) StartFile

func (f *Follow) StartFile(fileName string, t int, gt int, kill chan bool)

type LogServer

type LogServer struct {
	SiteName            string
	SiteTitle           string
	ServerAddr          string
	ServerUrl           string
	SockPerms           int
	UnixSocket          bool
	Path                string
	LogLevel            logging.Level
	M                   *macaron.Macaron
	PrepareServer       func(srv *LogServer) (err error)
	FileProvider        func(srv *LogServer, filename string, file *File) (err error)
	RequestFileProvider func(files *Files, ctx *macaron.Context, filename string) (*File, error)
	HomeHandler         interface{}
	Files               *Files
	Log                 *logging.Logger
	Data                map[string]interface{}
	RootPath            string
	ConfigFile          string
	OtherConfigFiles    []interface{}
	Config              *ini.File
	Dev                 bool
}

func NewServer

func NewServer() (s *LogServer)

func (*LogServer) ConfigString

func (s *LogServer) ConfigString() string

func (*LogServer) LoadConfig

func (s *LogServer) LoadConfig() (err error)

func (*LogServer) LoadConfigFromStringMap

func (s *LogServer) LoadConfigFromStringMap(m map[string]string) (err error)

func (*LogServer) NewFiles

func (s *LogServer) NewFiles() *Files

func (*LogServer) ParseConfig

func (s *LogServer) ParseConfig(cfg map[string]interface{}) (err error)

func (*LogServer) PrintConfig

func (s *LogServer) PrintConfig()

func (*LogServer) Route

func (g *LogServer) Route(path string) string

func (*LogServer) SetServerUrl

func (s *LogServer) SetServerUrl(serverUrl string) error

type Message

type Message struct {
	Out       string `json:"text"`
	Err       string `json:"text"`
	GlobalErr string `json:"text"`
	Text      string `json:"text"`
}

type Password

type Password string

func (Password) Redacted

func (p Password) Redacted() interface{}

type Sender

type Sender struct {
	Chan chan<- string
}

func (*Sender) Send

func (s *Sender) Send(t int, data interface{})

func (*Sender) SendClose

func (s *Sender) SendClose()

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

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