structured a bit more
This commit is contained in:
parent
fe92837134
commit
abdba6f958
@ -1,5 +1,9 @@
|
||||
package api
|
||||
|
||||
func serve() {
|
||||
import "git.cmdq.io/meirjann/DataLogue-Backend/log"
|
||||
|
||||
var logger = log.New("api")
|
||||
|
||||
func Serve() {
|
||||
logger.Println("starting server...")
|
||||
}
|
||||
|
9
configs/init.go
Normal file
9
configs/init.go
Normal file
@ -0,0 +1,9 @@
|
||||
package configs
|
||||
|
||||
import "git.cmdq.io/meirjann/DataLogue-Backend/log"
|
||||
|
||||
var logger = log.New("init")
|
||||
|
||||
func Init() {
|
||||
logger.Println("initializing...")
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
package db
|
||||
|
||||
func init() {
|
||||
import "git.cmdq.io/meirjann/DataLogue-Backend/log"
|
||||
|
||||
var logger = log.New("db")
|
||||
|
||||
func Init() {
|
||||
logger.Println("init db...")
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ func (w writer) Write(b []byte) (n int, err error) {
|
||||
|
||||
func New(msg string) *log.Logger {
|
||||
if len(msg) > 0 {
|
||||
return log.New(&writer{os.Stdout, "2006/01/02 15:04:05 "}, "["+msg+"] ", 0)
|
||||
return log.New(&writer{os.Stdout, "2006/01/02 15:04:05 "}, "["+msg+"] \t", 0)
|
||||
}
|
||||
return log.New(&writer{os.Stdout, "2006/01/02 15:04:05 "}, "[info] ", 0)
|
||||
return log.New(&writer{os.Stdout, "2006/01/02 15:04:05 "}, "[info] \t", 0)
|
||||
}
|
||||
|
8
main.go
8
main.go
@ -1,14 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"git.cmdq.io/meirjann/DataLogue-Backend/api"
|
||||
"git.cmdq.io/meirjann/DataLogue-Backend/configs"
|
||||
"git.cmdq.io/meirjann/DataLogue-Backend/db"
|
||||
"git.cmdq.io/meirjann/DataLogue-Backend/log"
|
||||
)
|
||||
|
||||
var logger = log.New("startup")
|
||||
|
||||
func main() {
|
||||
logger.Println("Start")
|
||||
logger.Println("starting...")
|
||||
// set all configs
|
||||
configs.Init()
|
||||
// init db
|
||||
db.Init()
|
||||
// start api
|
||||
api.Serve()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user