add stderr redirection, add logo

This commit is contained in:
Aynakeya
2022-07-15 16:30:50 -07:00
parent 8f2b975455
commit 24457e0acd
19 changed files with 102 additions and 117 deletions

View File

@@ -6,13 +6,18 @@ import (
"path"
)
const VERSION = "alpha 0.8.4"
const (
ProgramName = "卡西米尔唱片机"
Version = "alpha 0.8.4"
)
const CONFIG_PATH = "./config.ini"
const Assests_PATH = "./assets"
const (
ConfigPath = "./config.ini"
AssetsPath = "./assets"
)
func GetAssetPath(name string) string {
return path.Join(Assests_PATH, name)
return path.Join(AssetsPath, name)
}
type Config interface {
@@ -33,7 +38,7 @@ func LoadConfig(cfg Config) {
func init() {
var err error
ConfigFile, err = ini.Load(CONFIG_PATH)
ConfigFile, err = ini.Load(ConfigPath)
if err != nil {
fmt.Println("config not found, using default config")
ConfigFile = ini.Empty()

View File

@@ -3,8 +3,9 @@ package config
import "github.com/sirupsen/logrus"
type _LogConfig struct {
Path string
Level logrus.Level
Path string
Level logrus.Level
RedirectStderr bool
}
func (c *_LogConfig) Name() string {
@@ -12,6 +13,7 @@ func (c *_LogConfig) Name() string {
}
var Log = &_LogConfig{
Path: "./log.txt",
Level: logrus.InfoLevel,
Path: "./log.txt",
Level: logrus.InfoLevel,
RedirectStderr: false, // this should be true if it is in production mode.
}

View File

@@ -6,7 +6,7 @@ import (
)
func TestCreate(t *testing.T) {
fmt.Println(SaveToConfigFile(CONFIG_PATH))
fmt.Println(SaveToConfigFile(ConfigPath))
}
func TestLoad(t *testing.T) {