Added more logging to the plugin

This commit is contained in:
Andrey Meshkov 2018-10-30 12:57:16 +03:00
parent 591065aa3a
commit 0e065a2e61
1 changed files with 8 additions and 3 deletions

View File

@ -97,6 +97,7 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
blockValue := c.Val()
switch blockValue {
case "safebrowsing":
log.Println("Browsing security service is enabled")
p.d.EnableSafeBrowsing()
if c.NextArg() {
if len(c.Val()) == 0 {
@ -105,6 +106,7 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
p.d.SetSafeBrowsingServer(c.Val())
}
case "safesearch":
log.Println("Safe search is enabled")
p.d.EnableSafeSearch()
case "parental":
if !c.NextArg() {
@ -114,6 +116,8 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
if err != nil {
return nil, c.ArgErr()
}
log.Println("Parental control is enabled")
err = p.d.EnableParental(sensitivity)
if err != nil {
return nil, c.ArgErr()
@ -128,14 +132,15 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
if !c.NextArg() {
return nil, c.ArgErr()
}
blockttl, err := strconv.ParseUint(c.Val(), 10, 32)
blockedTtl, err := strconv.ParseUint(c.Val(), 10, 32)
if err != nil {
return nil, c.ArgErr()
}
p.settings.BlockedTTL = uint32(blockttl)
log.Printf("Blocked request TTL is %d", blockedTtl)
p.settings.BlockedTTL = uint32(blockedTtl)
case "querylog":
log.Println("Query log is enabled")
p.settings.QueryLogEnabled = true
case "filter":
if !c.NextArg() {
return nil, c.ArgErr()