From 343f67dc97126d2daeceaf582a526ca748743eb9 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 15 Oct 2018 12:03:35 -0400 Subject: [PATCH] Revert "Add log and auth modules" This reverts commit b8e79483a8d19a4670d68b2304215ce1045f1f55. --- modules/auth/auth.go | 25 ------------------------- modules/log/log.go | 28 ---------------------------- 2 files changed, 53 deletions(-) delete mode 100644 modules/auth/auth.go delete mode 100644 modules/log/log.go diff --git a/modules/auth/auth.go b/modules/auth/auth.go deleted file mode 100644 index 4f17546..0000000 --- a/modules/auth/auth.go +++ /dev/null @@ -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 -} diff --git a/modules/log/log.go b/modules/log/log.go deleted file mode 100644 index 67fa597..0000000 --- a/modules/log/log.go +++ /dev/null @@ -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) -}