structured a bit more

This commit is contained in:
lukas 2023-12-04 15:09:54 +01:00
parent fe92837134
commit abdba6f958
5 changed files with 28 additions and 5 deletions

View File

@ -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
View 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...")
}

View File

@ -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...")
}

View File

@ -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)
}

View File

@ -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()
}