mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Add option to toggle date/time in log messages
This commit is contained in:
parent
f7b7b63e3f
commit
91508c50b5
5 changed files with 49 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
const (
|
||||
defaultHTTPS = false
|
||||
defaultLogDateTime = false
|
||||
defaultHSTS = true
|
||||
defaultHTTPService = true
|
||||
defaultSchedulerService = true
|
||||
|
@ -47,6 +48,7 @@ const (
|
|||
// Options contains configuration options.
|
||||
type Options struct {
|
||||
HTTPS bool
|
||||
logDateTime bool
|
||||
hsts bool
|
||||
httpService bool
|
||||
schedulerService bool
|
||||
|
@ -84,6 +86,7 @@ type Options struct {
|
|||
func NewOptions() *Options {
|
||||
return &Options{
|
||||
HTTPS: defaultHTTPS,
|
||||
logDateTime: defaultLogDateTime,
|
||||
hsts: defaultHSTS,
|
||||
httpService: defaultHTTPService,
|
||||
schedulerService: defaultSchedulerService,
|
||||
|
@ -118,6 +121,11 @@ func NewOptions() *Options {
|
|||
}
|
||||
}
|
||||
|
||||
// LogDateTime returns true if the date/time should be displayed in log messages.
|
||||
func (o *Options) LogDateTime() bool {
|
||||
return o.logDateTime
|
||||
}
|
||||
|
||||
// HasDebugMode returns true if debug mode is enabled.
|
||||
func (o *Options) HasDebugMode() bool {
|
||||
return o.debug
|
||||
|
@ -283,6 +291,7 @@ func (o *Options) HTTPClientMaxBodySize() int64 {
|
|||
|
||||
func (o *Options) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString(fmt.Sprintf("LOG_DATE_TIME: %v\n", o.logDateTime))
|
||||
builder.WriteString(fmt.Sprintf("DEBUG: %v\n", o.debug))
|
||||
builder.WriteString(fmt.Sprintf("HTTP_SERVICE: %v\n", o.httpService))
|
||||
builder.WriteString(fmt.Sprintf("SCHEDULER_SERVICE: %v\n", o.schedulerService))
|
||||
|
|
|
@ -71,6 +71,8 @@ func (p *Parser) parseLines(lines []string) (err error) {
|
|||
value := strings.TrimSpace(fields[1])
|
||||
|
||||
switch key {
|
||||
case "LOG_DATE_TIME":
|
||||
p.opts.logDateTime = parseBool(value, defaultLogDateTime)
|
||||
case "DEBUG":
|
||||
p.opts.debug = parseBool(value, defaultDebug)
|
||||
case "BASE_URL":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue