All of the changes for func logs

This commit is contained in:
James
2017-06-19 11:38:11 -07:00
parent 8f753b779c
commit 8a3edb8309
39 changed files with 783 additions and 140 deletions

22
api/logs/log.go Normal file
View File

@@ -0,0 +1,22 @@
package logs
import (
"fmt"
"net/url"
"github.com/Sirupsen/logrus"
"gitlab-odx.oracle.com/odx/functions/api/models"
)
func New(dbURL string) (models.FnLog, error) {
u, err := url.Parse(dbURL)
if err != nil {
logrus.WithError(err).WithFields(logrus.Fields{"url": dbURL}).Fatal("bad DB URL")
}
logrus.WithFields(logrus.Fields{"db": u.Scheme}).Debug("creating new datastore")
switch u.Scheme {
case "bolt":
return NewBolt(u)
default:
return nil, fmt.Errorf("db type not supported %v", u.Scheme)
}
}