Version holds version information, when bumping this make sure to bump the released at stamp also.
const Version = "3.62.0"
ReleasedAt is the release timestamp for the given Version.
var ReleasedAt = time.Date(releaseYear, releaseMonth, releaseDay, releaseHour, releaseMin, 0, 0, time.UTC)
func SetLogger(logger Logger)
SetLogger sets 'logger' to be used by the unidoc unipdf library.
func UtcTimeFormat(t time.Time) string
UtcTimeFormat returns a formatted string describing a UTC timestamp.
ConsoleLogger is a logger that writes logs to the 'os.Stdout'
type ConsoleLogger struct { LogLevel LogLevel }
func NewConsoleLogger(logLevel LogLevel) *ConsoleLogger
NewConsoleLogger creates new console logger.
func (l ConsoleLogger) Debug(format string, args ...interface{})
Debug logs debug message.
func (l ConsoleLogger) Error(format string, args ...interface{})
Error logs error message.
func (l ConsoleLogger) Info(format string, args ...interface{})
Info logs info message.
func (l ConsoleLogger) IsLogLevel(level LogLevel) bool
IsLogLevel returns true if log level is greater or equal than `level`. Can be used to avoid resource intensive calls to loggers.
func (l ConsoleLogger) Notice(format string, args ...interface{})
Notice logs notice message.
func (l ConsoleLogger) Trace(format string, args ...interface{})
Trace logs trace message.
func (l ConsoleLogger) Warning(format string, args ...interface{})
Warning logs warning message.
DummyLogger does nothing.
type DummyLogger struct{}
func (DummyLogger) Debug(format string, args ...interface{})
Debug does nothing for dummy logger.
func (DummyLogger) Error(format string, args ...interface{})
Error does nothing for dummy logger.
func (DummyLogger) Info(format string, args ...interface{})
Info does nothing for dummy logger.
func (DummyLogger) IsLogLevel(level LogLevel) bool
IsLogLevel returns true from dummy logger.
func (DummyLogger) Notice(format string, args ...interface{})
Notice does nothing for dummy logger.
func (DummyLogger) Trace(format string, args ...interface{})
Trace does nothing for dummy logger.
func (DummyLogger) Warning(format string, args ...interface{})
Warning does nothing for dummy logger.
LogLevel is the verbosity level for logging.
type LogLevel int
Defines log level enum where the most important logs have the lowest values. I.e. level error = 0 and level trace = 5
const ( LogLevelTrace LogLevel = 5 LogLevelDebug LogLevel = 4 LogLevelInfo LogLevel = 3 LogLevelNotice LogLevel = 2 LogLevelWarning LogLevel = 1 LogLevelError LogLevel = 0 )
Logger is the interface used for logging in the unipdf package.
type Logger interface { Error(format string, args ...interface{}) Warning(format string, args ...interface{}) Notice(format string, args ...interface{}) Info(format string, args ...interface{}) Debug(format string, args ...interface{}) Trace(format string, args ...interface{}) IsLogLevel(level LogLevel) bool }
Log is a global instance of the logger instance. It is thread safe, i.e. can be used by multiple go routines.
var Log Logger = DummyLogger{}
WriterLogger is the logger that writes data to the Output writer
type WriterLogger struct { LogLevel LogLevel Output io.Writer }
func NewWriterLogger(logLevel LogLevel, writer io.Writer) *WriterLogger
NewWriterLogger creates new 'writer' logger.
func (l WriterLogger) Debug(format string, args ...interface{})
Debug logs debug message.
func (l WriterLogger) Error(format string, args ...interface{})
Error logs error message.
func (l WriterLogger) Info(format string, args ...interface{})
Info logs info message.
func (l WriterLogger) IsLogLevel(level LogLevel) bool
IsLogLevel returns true if log level is greater or equal than `level`. Can be used to avoid resource intensive calls to loggers.
func (l WriterLogger) Notice(format string, args ...interface{})
Notice logs notice message.
func (l WriterLogger) Trace(format string, args ...interface{})
Trace logs trace message.
func (l WriterLogger) Warning(format string, args ...interface{})
Warning logs warning message.