Skip to content

PJSoftware/go-file-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

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

To use this with log:

flog.UseLog(logFile)

To use this with slog:

logger := flog.UseSLogJSON(logFile, opts)

or

logger := flog.UseSLogText(logFile, opts)

The file will be created as:

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages