enable logging support for torrc builder
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dan Ballard 2022-09-21 13:06:15 -07:00
parent 72f689de26
commit 1f52dc7138
1 changed files with 14 additions and 0 deletions

View File

@ -10,6 +10,14 @@ import (
type TorLogLevel string
const TorLogLevelDebug TorLogLevel = "debug"
const TorLogLevelNotice TorLogLevel = "notice"
const TorLogLevelInfo TorLogLevel = "info"
const TorLogLevelWarn TorLogLevel = "warn"
const TorLogLevelErr TorLogLevel = "err"
// TorrcBuilder is a a helper for building torrc files
type TorrcBuilder struct {
lines []string
@ -34,6 +42,12 @@ func (tb *TorrcBuilder) WithControlPort(port int) *TorrcBuilder {
return tb
// WithLog sets the Log to file directive to the specified with with the specified log level
func (tb *TorrcBuilder) WithLog(logfile string, level TorLogLevel) *TorrcBuilder {
tb.lines = append(tb.lines, fmt.Sprintf("Log %v file %v", level, logfile))
return tb
// WithCustom clobbers the torrc builder and allows the client to set any option they want, while benefiting
// from other configuration options.
func (tb *TorrcBuilder) WithCustom(lines []string) *TorrcBuilder {