Skip to content

Commit 39a7d42

Browse files
committed
add Logger-related params to Flags
1 parent 3fd13b0 commit 39a7d42

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,5 @@ This is not needed for most of your assets because their filenames should contai
155155
| SPA_MODE | `--spa` or `--spa <bool>` | When SPA mode if file for requested path does not exists server returns index.html from root of serving directory. SPA mode and directory listing cannot be enabled at the same time | `true` |
156156
| CACHE | `--cache` | When enabled f.Open reads are being cached using Two Queue LRU Cache in bits | `true` |
157157
| CACHE_BUFFER | `--cache-buffer <number>` | Specifies the maximum size of LRU cache in bytes | `51200` |
158+
| LOGGER | `--logger` | Enable requests logger | `false` |
159+
| LOG_PRETTY | `--log-pretty` | Print log messages in a pretty format instead of default JSON format | `false` |

src/param/param.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ var Flags = []cli.Flag{
6969
Name: "cache-buffer",
7070
Value: 50 * 1024,
7171
},
72+
&cli.BoolFlag{
73+
EnvVars: []string{"LOGGER"},
74+
Name: "logger",
75+
Value: false,
76+
},
77+
&cli.BoolFlag{
78+
EnvVars: []string{"LOG_PRETTY"},
79+
Name: "log-pretty",
80+
Value: false,
81+
},
7282
}
7383

7484
type Params struct {
@@ -83,8 +93,9 @@ type Params struct {
8393
IgnoreCacheControlPaths []string
8494
CacheEnabled bool
8595
CacheBuffer int
96+
Logger bool
97+
LogPretty bool
8698
//DirectoryListing bool
87-
8899
}
89100

90101
func ContextToParams(c *cli.Context) *Params {
@@ -100,6 +111,8 @@ func ContextToParams(c *cli.Context) *Params {
100111
IgnoreCacheControlPaths: c.StringSlice("ignore-cache-control-paths"),
101112
CacheEnabled: c.Bool("cache"),
102113
CacheBuffer: c.Int("cache-buffer"),
114+
Logger: c.Bool("logger"),
115+
LogPretty: c.Bool("log-pretty"),
103116
//DirectoryListing: c.Bool("directory-listing"),
104117
}
105118
}

0 commit comments

Comments
 (0)