enable logging support for torrc builder #36
|
@ -10,6 +10,14 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue