Documentation ¶
Overview ¶
Package htmllog, a simple logger that produces an append-only, reloading HTML file
Features
usable by multiple go-routines protection against printing recursive data structures in message configureable log event function configureable Html style configureable limit on message
Example
h, err := htmllog.New("myapp.log") h.Infof("just now is %v", time.Now())
Index ¶
- Constants
- Variables
- func LimitedSprintf(limit int, format string, args ...interface{}) string
- func LogEvent(hyper *Logger, logLevel, htmlEscapedMessage string)
- type EventFunc
- type Logger
- func (l *Logger) Br()
- func (l *Logger) Configure(scroll string, style string, newLimit int, logFunc EventFunc)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Div(cls string, block func())
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Event(level string, format string, args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Level(level string)
- func (l *Logger) Nbsp(s string, size int) string
- func (l *Logger) Raw(htmlEscapedMessage string)
- func (l *Logger) Reset() error
- func (l *Logger) Timestamp()
- func (l *Logger) Warnf(format string, args ...interface{})
Constants ¶
View Source
const ( Debug = "debug" Info = "info" Warn = "warn" Error = "error" Fatal = "fatal" )
Variables ¶
View Source
var DefaultMaxMessageSize = 200
DefaultMaxMessageSize specifies the maxium length that a message can be.
View Source
var DefaultScrollToBottom = `` /* 252-byte string literal not displayed */
View Source
var DefaultStyle = `` /* 598-byte string literal not displayed */
Functions ¶
func LimitedSprintf ¶
LimitedSprintf returns the result of fmt.Sprintf limited to a number of bytes. Use this function to protect against printing recursive structures.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides a thread-safe access to the Html file for writing log events.
func (*Logger) Br ¶
func (l *Logger) Br()
Br writes a Html linebreak. Must be called in a protected region.
func (*Logger) Div ¶
Div writes the begin and end div tags around the block call. Must be called in a protected region.
func (*Logger) Nbsp ¶
Nbsp returns a new string of a fixed size, padded with Html non-breaking spaces.
Click to show internal directories.
Click to hide internal directories.