Documentation
¶
Index ¶
Constants ¶
const LOG_EXTENSION = ".log"
The file extension to use for all new log files that are created
Variables ¶
This section is empty.
Functions ¶
func StandardLogger ¶
StandardLogger will return a Logger struct which will hoard a massive amount of logs and messages. Recommended for systems with a healthy amount of free disk space. Logs can be left unchecked for up to 7 days before they're pruned. If you don't want to check them and you don't want to lose them then make sure you download them via REST otherwise you'll miss log data.
Types ¶
type Logger ¶
type Logger struct { MaxLogFileCount uint64 // The maximum number of log files saved to disk before pruning occurs MaxLogMessageCount uint64 // The maximum number of bytes a log file can take up before it's cut off and a new one is created MaxLogDuration uint64 // The maximum number of seconds a log can exist for before it's cut off and a new one is created // contains filtered or unexported fields }
Logger allows for aggressive log management in scenarios where disk space might be limited. You can limit based on log message count or duration and also prune log files when too many are saved on disk.
var Lgr *Logger
func CustomLogger ¶
func CustomLogger(logBaseName string, maxFileCount uint64, maxMessageCount uint64, maxDuration uint64) (*Logger, error)
CustomLogger returns a logger with the given variables customized to your liking. Smaller values are better for devices with less free space and vice versa for devices with more free space.
func (*Logger) CurrentLogContents ¶
CurrentLogContents returns the contents of the current log file that's being managed by the logger instance. The current log should be active thus multiple calls to CurrentLogContents() should give different results assuming the log is being actively written to.
func (*Logger) CurrentLogFile ¶
CurrentLogFile returns a pointer to the current os.File representation of the current log file that is being written to. If this reference is held log enough it can become invalid if the log file is pruned from the disk.
func (*Logger) CurrentLogName ¶
CurrentLogName returns the name of the file which contains the most current log output. This log will be active and likely changing frequently.
func (*Logger) LogMessage ¶
LogMessage will write the given string to the current active log file. It will then perform all the necessary checks to make sure that the max number of messages, the max duration of the log file, and the maximum number of overall log files has not been reached. If any of the above parameters have been tripped, action will be taken accordingly.