mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Optionally enable local time for logging
Introduces the option `-log-local-time` which switches to local time for logging instead of using UTC. Also if this option is applied, a message is being output to the log on startup about the usage of local time to draw attention, so the user/operator can take care of anonymity in case the logs are going to be shared.
This commit is contained in:
parent
0e0ca8721e
commit
028ff82683
2 changed files with 17 additions and 2 deletions
|
@ -27,6 +27,7 @@ func main() {
|
|||
logFilename := flag.String("log", "", "log `filename`. If not specified, logs will be output to stderr (console).")
|
||||
rawBrokerURL := flag.String("broker", sf.DefaultBrokerURL, "The `URL` of the broker server that the proxy will be using to find clients")
|
||||
unsafeLogging := flag.Bool("unsafe-logging", false, "keep IP addresses and other sensitive info in the logs")
|
||||
logLocalTime := flag.Bool("log-local-time", false, "Use local time for logging (default: UTC)")
|
||||
keepLocalAddresses := flag.Bool("keep-local-addresses", false, "keep local LAN address ICE candidates.\nThis is usually pointless because Snowflake clients don't usually reside on the same local network as the proxy.")
|
||||
defaultRelayURL := flag.String("relay", sf.DefaultRelayURL, "The default `URL` of the server (relay) that this proxy will forward client connections to, in case the broker itself did not specify the said URL")
|
||||
probeURL := flag.String("nat-probe-server", sf.DefaultNATProbeURL, "The `URL` of the server that this proxy will use to check its network NAT type.\nDetermining NAT type helps to understand whether this proxy is compatible with certain clients' NAT")
|
||||
|
@ -115,7 +116,14 @@ func main() {
|
|||
|
||||
var logOutput = io.Discard
|
||||
var eventlogOutput io.Writer = os.Stderr
|
||||
log.SetFlags(log.LstdFlags | log.LUTC)
|
||||
|
||||
loggerFlags := log.LstdFlags
|
||||
|
||||
if !*logLocalTime {
|
||||
loggerFlags |= log.LUTC
|
||||
}
|
||||
|
||||
log.SetFlags(loggerFlags)
|
||||
|
||||
if *verboseLogging {
|
||||
logOutput = os.Stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue