Merge pull request 'enable logging support for torrc builder' (#36) from logging into master
continuous-integration/drone/push Build is pending
Details
continuous-integration/drone/push Build is pending
Details
Reviewed-on: #36 Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
commit
51029af959
|
@ -10,6 +10,14 @@ import (
|
||||||
"strings"
|
"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
|
// TorrcBuilder is a a helper for building torrc files
|
||||||
type TorrcBuilder struct {
|
type TorrcBuilder struct {
|
||||||
lines []string
|
lines []string
|
||||||
|
@ -34,6 +42,12 @@ func (tb *TorrcBuilder) WithControlPort(port int) *TorrcBuilder {
|
||||||
return tb
|
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
|
// WithCustom clobbers the torrc builder and allows the client to set any option they want, while benefiting
|
||||||
// from other configuration options.
|
// from other configuration options.
|
||||||
func (tb *TorrcBuilder) WithCustom(lines []string) *TorrcBuilder {
|
func (tb *TorrcBuilder) WithCustom(lines []string) *TorrcBuilder {
|
||||||
|
|
Loading…
Reference in New Issue