Categorygithub.com/pjsoftware/go-file-logger
repositorypackage
0.0.4
Repository: https://github.com/pjsoftware/go-file-logger.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

= go-file-logger: v0.0.4

For use with the standard "log" and "slog" libraries.

This package generates a log file link that is useful for command-line programs; less so for long-running services.

[,go]

import flog "github.com/pjsoftware/go-file-logger"

logFile := flog.LogWriter(appName) defer logFile.Close()

To use this with log:

[,go]

flog.UseLog(logFile)

To use this with slog:

[,go]

logger := flog.UseSLogJSON(logFile, opts)

or

[,go]

logger := flog.UseSLogText(logFile, opts)

The file will be created as:


c:\LogFiles\YYYY\MM\DD\YYYYMMDD-appName.log