Revert "Add log and auth modules"
This reverts commit b8e79483a8d19a4670d68b2304215ce1045f1f55.
This commit is contained in:
parent
114cb9e40a
commit
343f67dc97
|
@ -1,25 +0,0 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
uuid "github.com/nu7hatch/gouuid"
|
||||
"strings"
|
||||
|
||||
"code.as/writeas/web/modules/log"
|
||||
)
|
||||
|
||||
// GetToken parses out the user token from an Authorization header.
|
||||
func GetToken(header string) []byte {
|
||||
var accessToken []byte
|
||||
if len(header) > 0 {
|
||||
f := strings.Fields(header)
|
||||
if len(f) == 2 && f[0] == "Token" {
|
||||
t, err := uuid.ParseHex(f[1])
|
||||
if err != nil {
|
||||
log.Error("Couldn't parseHex on '%s': %v", accessToken, err)
|
||||
} else {
|
||||
accessToken = t[:]
|
||||
}
|
||||
}
|
||||
}
|
||||
return accessToken
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// log holds loggers for the application
|
||||
package log
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
i *log.Logger
|
||||
e *log.Logger
|
||||
)
|
||||
|
||||
// Init creates the local loggers used in the app.
|
||||
func Init() {
|
||||
i = log.New(os.Stdout, "", log.Ldate|log.Ltime)
|
||||
e = log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile)
|
||||
}
|
||||
|
||||
// Info logs an informational message to Stdout.
|
||||
func Info(s string, v ...interface{}) {
|
||||
i.Printf(s, v)
|
||||
}
|
||||
|
||||
// Error logs an error to Stderr.
|
||||
func Error(s string, v ...interface{}) {
|
||||
e.Printf(s, v)
|
||||
}
|
Loading…
Reference in New Issue