Documentation ¶
Index ¶
- type CallbackAsyncWriter
- type CallbackWriter
- type CallbackWriterCallback
- type FileRotateWriter
- type FileWriter
- type OnItemFunc
- type StateChangeCallback
- type StdoutWriter
- type SyslogWriter
- type TcpWriter
- type TelegramWriter
- type Writer
- func (w *Writer) Enqueue(item *logs.Item)
- func (w *Writer) Feedback(level logs.Level, args ...any)
- func (w *Writer) FeedbackError(err error)
- func (w *Writer) Feedbackf(level logs.Level, format string, args ...any)
- func (w *Writer) ID() string
- func (w *Writer) SetFeedbackChan(ch chan *logs.Item)
- func (w *Writer) Start() error
- func (w *Writer) StartQueue(queueSize int, f OnItemFunc)
- func (w *Writer) Stop()
- func (w *Writer) StopQueue(timeoutSecs int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackAsyncWriter ¶ added in v1.0.0
type CallbackAsyncWriter struct { Writer // contains filtered or unexported fields }
func NewCallbackAsyncWriter ¶
func NewCallbackAsyncWriter(callback CallbackWriterCallback) *CallbackAsyncWriter
NewCallbackAsyncWriter returns a callbackAsyncWriter.
func (*CallbackAsyncWriter) Start ¶ added in v1.0.0
func (w *CallbackAsyncWriter) Start() error
func (*CallbackAsyncWriter) Stop ¶ added in v1.0.0
func (w *CallbackAsyncWriter) Stop()
func (*CallbackAsyncWriter) Write ¶ added in v1.0.0
func (w *CallbackAsyncWriter) Write(item *logs.Item)
type CallbackWriter ¶ added in v1.0.0
type CallbackWriter struct { Writer // contains filtered or unexported fields }
func NewCallbackWriter ¶
func NewCallbackWriter(callback CallbackWriterCallback) *CallbackWriter
NewCallbackWriter returns a callbackWriter.
func (*CallbackWriter) Write ¶ added in v1.0.0
func (w *CallbackWriter) Write(item *logs.Item)
type CallbackWriterCallback ¶
CallbackWriterCallback define the writer callback.
type FileRotateWriter ¶ added in v1.0.2
type FileRotateWriter struct { Writer // contains filtered or unexported fields }
func NewFileRotateWriter ¶ added in v1.0.2
func NewFileRotateWriter(filename string, rotateAfter time.Duration, deleteNotCritical bool) (*FileRotateWriter, error)
NewFileRotateWriter returns a FileRotateWriter. - rotateAfter: how long between one rotation and another (0 = no rotation). - deleteNotCritical: if True removes the rotations that do not contain critical logs.
func (*FileRotateWriter) Stop ¶ added in v1.0.2
func (w *FileRotateWriter) Stop()
func (*FileRotateWriter) Write ¶ added in v1.0.2
func (w *FileRotateWriter) Write(item *logs.Item)
type FileWriter ¶ added in v1.0.0
type FileWriter struct { Writer // contains filtered or unexported fields }
func NewFileWriter ¶
func NewFileWriter(filename string) (*FileWriter, error)
NewFileWriter returns a fileWriter.
func (*FileWriter) Stop ¶ added in v1.0.0
func (w *FileWriter) Stop()
func (*FileWriter) Write ¶ added in v1.0.0
func (w *FileWriter) Write(item *logs.Item)
type OnItemFunc ¶ added in v1.0.0
type StateChangeCallback ¶
type StateChangeCallback func(bool)
StateChangeCallback is called (true) when first client connecting, and (false) when there are no more clients.
type StdoutWriter ¶ added in v1.0.0
type StdoutWriter struct { Writer // contains filtered or unexported fields }
func (*StdoutWriter) Write ¶ added in v1.0.0
func (w *StdoutWriter) Write(item *logs.Item)
type SyslogWriter ¶ added in v1.0.0
type SyslogWriter struct { Writer // contains filtered or unexported fields }
func NewSyslogWriter ¶
func NewSyslogWriter(tag string) *SyslogWriter
If tag is empty, the os.Args[0] is used.
func (*SyslogWriter) Stop ¶ added in v1.0.0
func (w *SyslogWriter) Stop()
func (*SyslogWriter) Write ¶ added in v1.0.0
func (w *SyslogWriter) Write(item *logs.Item)
type TcpWriter ¶ added in v1.0.0
type TcpWriter struct { Writer // contains filtered or unexported fields }
func NewTCPWriter ¶
Ritorna un nuovo TCP Writer. - debug: se attivo logga in feedback eventuali errori e cambi di stato.
type TelegramWriter ¶ added in v1.0.0
type TelegramWriter struct { Writer // contains filtered or unexported fields }
func NewTelegramWriter ¶
func NewTelegramWriter(botAPIKey string, channelID int) *TelegramWriter
NewTelegramWriter returns a telegramWriter.
func (*TelegramWriter) Start ¶ added in v1.0.0
func (w *TelegramWriter) Start() error
func (*TelegramWriter) Stop ¶ added in v1.0.0
func (w *TelegramWriter) Stop()
func (*TelegramWriter) Write ¶ added in v1.0.0
func (w *TelegramWriter) Write(item *logs.Item)
Write enqueue an item and returns immediately, or blocks while the internal queue is full.
type Writer ¶ added in v1.0.0
type Writer struct {
// contains filtered or unexported fields
}
Implementa i metodi base.
func (*Writer) Feedback ¶ added in v1.0.0
Genera un item e lo invia al writer di default del rispettivo livello.
func (*Writer) FeedbackError ¶ added in v1.0.0
Incapsula e invia un errore al writer di default del livello ErrorLevel.
func (*Writer) Feedbackf ¶ added in v1.0.0
Genera un item e lo invia al writer di default del rispettivo livello.
func (*Writer) SetFeedbackChan ¶ added in v1.0.0
Imposta il canale interno di feeback. Viene invocata dal logger quando imposta un nuovo writer per un certo livello.
func (*Writer) StartQueue ¶ added in v1.0.0
func (w *Writer) StartQueue(queueSize int, f OnItemFunc)
Avvia il worker di gestione della coda, invocando la callback OnItemFunc() per ogni item da processare. Se la callback ritorna errore questo viene feedbackato al writer di default del rispettivo livello.