]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - fifos/log.go
Ability to remove hosts from the states, refactoring
[tofuproxy.git] / fifos / log.go
similarity index 60%
rename from fifos/fifos.go
rename to fifos/log.go
index f07085f9d803d4523d1ffff00b697c2bf9bd072d..398aa2562f1a2b7b03e06ab4648ceb357f48f39a 100644 (file)
@@ -20,26 +20,28 @@ package fifos
 import (
        "log"
        "os"
-       "path/filepath"
        "time"
 
        "go.cypherpunks.ru/tai64n/v2"
 )
 
 var (
-       NoTAI     bool
-       FIFOs     string
-       SinkCert  = make(chan string)
-       SinkDANE  = make(chan string)
-       SinkErr   = make(chan string)
-       SinkOK    = make(chan string)
-       SinkOther = make(chan string)
-       SinkRedir = make(chan string)
-       SinkReq   = make(chan string)
-       SinkTLS   = make(chan string)
+       NoTAI bool
+
+       LogCert     = make(chan string)
+       LogDANE     = make(chan string)
+       LogErr      = make(chan string)
+       LogHTTPAuth = make(chan string)
+       LogNonOK    = make(chan string)
+       LogOK       = make(chan string)
+       LogRedir    = make(chan string)
+       LogReq      = make(chan string)
+       LogTLS      = make(chan string)
+       LogTLSAuth  = make(chan string)
+       LogVarious  = make(chan string)
 )
 
-func sinker(c chan string, p string) {
+func logger(c chan string, p string) {
        tai := new(tai64n.TAI64N)
        for {
                fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
@@ -60,14 +62,3 @@ func sinker(c chan string, p string) {
                fd.Close()
        }
 }
-
-func Init() {
-       go sinker(SinkCert, filepath.Join(FIFOs, "cert"))
-       go sinker(SinkDANE, filepath.Join(FIFOs, "dane"))
-       go sinker(SinkErr, filepath.Join(FIFOs, "err"))
-       go sinker(SinkOK, filepath.Join(FIFOs, "ok"))
-       go sinker(SinkOther, filepath.Join(FIFOs, "other"))
-       go sinker(SinkRedir, filepath.Join(FIFOs, "redir"))
-       go sinker(SinkReq, filepath.Join(FIFOs, "req"))
-       go sinker(SinkTLS, filepath.Join(FIFOs, "tls"))
-}