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
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
func NewProxyEventLogger(output io.Writer, disableStats bool) event.SnowflakeEventReceiver {
|
||||
logger := log.New(output, "", log.LstdFlags|log.LUTC)
|
||||
logger := log.New(output, "", log.Flags())
|
||||
return &proxyEventLogger{logger: logger, disableStats: disableStats}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,13 @@ type proxyEventLogger struct {
|
|||
|
||||
func (p *proxyEventLogger) OnNewSnowflakeEvent(e event.SnowflakeEvent) {
|
||||
switch e.(type) {
|
||||
case event.EventOnProxyStarting:
|
||||
p.logger.Println(e.String())
|
||||
|
||||
if p.logger.Flags()&log.LUTC == 0 {
|
||||
p.logger.Println("Local time is being used for logging. If you want to " +
|
||||
"share your log, consider to modify the date/time for more anonymity.")
|
||||
}
|
||||
case event.EventOnProxyStats:
|
||||
if !p.disableStats {
|
||||
p.logger.Println(e.String())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue