util

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode_log_msg

func Decode_log_msg(msg_bytes []byte) string

Do not call this method on a running server as it may crash the server Even if you call it on your own log file, if your log file was partly written it can still crash your program But the Rotate function isn't affected because it only looks for newlines. Since we don't write any newlines except at the end of every log message, it's fine.

func Encode_log_msg

func Encode_log_msg(dangerous_bytes []byte) []byte

func Get_first_line_from_file

func Get_first_line_from_file(f *os.File) ([]byte, error)

This function returns the first line in the file It will return an error if the file is empty or contains no newlines Make sure every read is preceded by a seek.

func Get_last_nonempty_line_from_file

func Get_last_nonempty_line_from_file(f *os.File) ([]byte, error)

This function returns the last non-empty line in the file It will return an error if there's only one line in the file, or if the file is empty, or if the file only contains newlines Make sure every read is preceded by a seek.

func Try_parse_log_file_line

func Try_parse_log_file_line(line string) (time.Time, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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