Browse Source

En cours de développement

master
mls-361 5 months ago
parent
commit
42f295d628
  1. 2
      cmd/main.go
  2. 14
      go.mod
  3. 32
      go.sum
  4. 13
      internal/config/data/logger.go
  5. 20
      internal/logger/logger.go

2
cmd/main.go

@ -161,6 +161,8 @@ func run() error {
"uptime", time.Since(app.StartedAt()).Round(time.Second).String(),
)
_ = ccs.Logger.Close()
return app.OnError(err)
}

14
go.mod

@ -3,16 +3,16 @@ module forge.chapril.org/armen/armen
go 1.16
require (
forge.chapril.org/armen/jw v0.0.0-20210511100135-fb354113d017
forge.chapril.org/armen/memory v0.0.0-20210511100654-b2b750215c45
forge.chapril.org/armen/model v0.0.0-20210511115214-d61381b57ce4
forge.chapril.org/armen/runner v0.0.0-20210511115247-a2211ca58f4a
forge.chapril.org/armen/workers v0.0.0-20210511115530-b6ef81bf7e45
forge.chapril.org/armen/jw v0.0.0-20210511132624-d71a22d95ec5
forge.chapril.org/armen/memory v0.0.0-20210511132711-b1c1e20fc92c
forge.chapril.org/armen/model v0.0.0-20210511132800-2113f474dfb2
forge.chapril.org/armen/runner v0.0.0-20210511132841-ba61c2e7048d
forge.chapril.org/armen/workers v0.0.0-20210511132904-6526f67fafeb
forge.chapril.org/mls-361/application v0.0.0-20210511091326-7ec1158728fd
forge.chapril.org/mls-361/crypto v0.0.0-20210507222429-aa9bfa212956
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140
forge.chapril.org/mls-361/jsonapi v0.0.0-20210511115854-6ecaf78600bd
forge.chapril.org/mls-361/logger v0.0.0-20210511095341-cf849543bdbf
forge.chapril.org/mls-361/jsonapi v0.0.0-20210511132603-69b1338836bd
forge.chapril.org/mls-361/logger v0.0.0-20210511132528-884fa4c98c68
forge.chapril.org/mls-361/uuid v0.0.0-20210511091055-533cd6b13c6f
github.com/julienschmidt/httprouter v1.3.0
)

32
go.sum

@ -1,15 +1,15 @@
forge.chapril.org/armen/factory v0.0.0-20210511100412-29bf9fe72a2a h1:3b2dUsbSLEQ7XmHq5Lz2PznKixmD1U0OUu0h+J3Q/iA=
forge.chapril.org/armen/factory v0.0.0-20210511100412-29bf9fe72a2a/go.mod h1:zDzd8RCaGYgSrZU819c55oB3tm9/0sJvEQR8y/XkHGQ=
forge.chapril.org/armen/jw v0.0.0-20210511100135-fb354113d017 h1:xfsMUu1evMGPQJ38ZXZN0x1bPr+VylMQUz/OkoDEe7k=
forge.chapril.org/armen/jw v0.0.0-20210511100135-fb354113d017/go.mod h1:9Ilw0X1FS6y5BlOzl3CKpOUkYWasLldqYEjy2sIyo8M=
forge.chapril.org/armen/memory v0.0.0-20210511100654-b2b750215c45 h1:AEXd5zoq4SQknEqgX4qyuoGLmRmLcWGy4O3vW0jykH0=
forge.chapril.org/armen/memory v0.0.0-20210511100654-b2b750215c45/go.mod h1:RBiYGOiz3N4xx/nn/XKK7rdX3G4EjXZGcMDRXxtwMq0=
forge.chapril.org/armen/model v0.0.0-20210511115214-d61381b57ce4 h1:H0uiEIEpzBJpvt2WBB3UDj2utC1WMtdgbIWH3vtL3kM=
forge.chapril.org/armen/model v0.0.0-20210511115214-d61381b57ce4/go.mod h1:6CDuKzXwqL8D2qgo19zfUY8mSaKwem9NiwAuGIGuQHw=
forge.chapril.org/armen/runner v0.0.0-20210511115247-a2211ca58f4a h1:aGrvVGzYEGKwImYLzQcxlzBRb9Tg8yMX6bI6sDxhFgc=
forge.chapril.org/armen/runner v0.0.0-20210511115247-a2211ca58f4a/go.mod h1:i9J1g0DusWQ1YIIYGo62Y7eL71wr3qBKxzoZ8MYhRzA=
forge.chapril.org/armen/workers v0.0.0-20210511115530-b6ef81bf7e45 h1:IEeWXi9kCxQNA2IoBrmUIaR3xDsaZbskyPnGYNGrc7g=
forge.chapril.org/armen/workers v0.0.0-20210511115530-b6ef81bf7e45/go.mod h1:ZrP5XeB+oo+jMBuaN7po4d+iAwILLPrM2tVkwMOPYg0=
forge.chapril.org/armen/factory v0.0.0-20210511132651-23cb0fccb1f1 h1:mSjN2RaGDyDFVDHWSkzbzNpo0jhb6KlXeyWRF9wE0ac=
forge.chapril.org/armen/factory v0.0.0-20210511132651-23cb0fccb1f1/go.mod h1:oNJXbn1Pt8zzeWQ5tu4SyVatfwEEXZoaKVAPbnSGZNA=
forge.chapril.org/armen/jw v0.0.0-20210511132624-d71a22d95ec5 h1:6m15nDWXnuZZ1QWWokcpYhDLoacGhnV72+MfqmrCq78=
forge.chapril.org/armen/jw v0.0.0-20210511132624-d71a22d95ec5/go.mod h1:MHbY6YeA2NX+3tzhyyqfBZI/z4j6cteHWML/q5eqHoU=
forge.chapril.org/armen/memory v0.0.0-20210511132711-b1c1e20fc92c h1:Z/n80FRAo6AqXoiD5uydAoBMpVUh8Sl6+ygmMPbSAjo=
forge.chapril.org/armen/memory v0.0.0-20210511132711-b1c1e20fc92c/go.mod h1:nztY3sIvBB6Tent8vw45HzWB645cBDcL1NoKRgrYV5M=
forge.chapril.org/armen/model v0.0.0-20210511132800-2113f474dfb2 h1:DWNOqO09y1duxxrfukst5on3KHEscZ1IncoUrBqGNAo=
forge.chapril.org/armen/model v0.0.0-20210511132800-2113f474dfb2/go.mod h1:YOB9JV9WWH1wHhOibx11332R1fUiBQLSjxh5lnYkrYs=
forge.chapril.org/armen/runner v0.0.0-20210511132841-ba61c2e7048d h1:m+fKmWD4ULXu3sxV8YouvtEowpJ5XiREbih9GE3RmTw=
forge.chapril.org/armen/runner v0.0.0-20210511132841-ba61c2e7048d/go.mod h1:46OtwcOFB4v/dCkkca2TrbAK5ANQIy5QpfNHxGmHtG4=
forge.chapril.org/armen/workers v0.0.0-20210511132904-6526f67fafeb h1:OZGAJdBteNAnwuN4pQq7v0Jg4DsZRx8vlBWuj/vVsGs=
forge.chapril.org/armen/workers v0.0.0-20210511132904-6526f67fafeb/go.mod h1:IpgnwaWvKOuGLqm/GC1Wnn+bZwUdHaHJobHUW36x6dE=
forge.chapril.org/mls-361/application v0.0.0-20210511091326-7ec1158728fd h1:TxjOhFddFJEaGl20mLJzbdr8kbETys+XHT4v5jitdys=
forge.chapril.org/mls-361/application v0.0.0-20210511091326-7ec1158728fd/go.mod h1:qO6QOXIo8KMDDD+dFv6uJ4AgbaTbjICi9LD0iNnUxJg=
forge.chapril.org/mls-361/buffer v0.0.0-20210410182428-5dc7a7b2ae79 h1:Lh+y98uVFC7btl5FdxKNtokzHD2j14R4ZIgJECao6r4=
@ -20,12 +20,12 @@ forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140 h1:uBp4Uz62/
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140/go.mod h1:GBBbrcpLm0Hww05AoFQJY3tTXbNBOQPqV+qTFEWpL20=
forge.chapril.org/mls-361/fqdn v0.0.0-20210507222326-a85c3c19b9af h1:TbPVsBz8TYVmyqcrskFWlheyapWsuNrCVd6HedWuRjc=
forge.chapril.org/mls-361/fqdn v0.0.0-20210507222326-a85c3c19b9af/go.mod h1:AFGBvcK+UEZ9riVN+xN0suL8mVhBrxQIMKK39EX434s=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210511115854-6ecaf78600bd h1:Z+4Hz1En/Ka67Z5WQq6tLsRNuaMaOfalZskCbfk8B8A=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210511115854-6ecaf78600bd/go.mod h1:Wcl8Jn+noUG743lGE9U5f35NSPB0bYeJMJHHzHGSzlk=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210511132603-69b1338836bd h1:3ar3JNxBn1Iow6P8heK6w+oqHR2PDFSx1LDIHKQuE/M=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210511132603-69b1338836bd/go.mod h1:13gCyaUS8fBW0K0ToNPHoiT96e3XMPvZXKQu6xOwc/M=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210507213839-4f18d8b29e73 h1:OKwxmpmkdhy9SWwZcJrz7Fp57LWpY/PNloHdFiDc4Ek=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210507213839-4f18d8b29e73/go.mod h1:bv44R0CAd8lQV4ub1hjLE3kWYwpfsW4Ro9zRnD4YOMU=
forge.chapril.org/mls-361/logger v0.0.0-20210511095341-cf849543bdbf h1:CmobEbieeKPcje43phYbRH8GavpzktlXJGX7z/fEGCc=
forge.chapril.org/mls-361/logger v0.0.0-20210511095341-cf849543bdbf/go.mod h1:R/JAwND755VIZ+uTkwqtgY3GmPzS+Nn8NKXPXBr2JwQ=
forge.chapril.org/mls-361/logger v0.0.0-20210511132528-884fa4c98c68 h1:n5qBjDnfCFOb3LWJj/ySg7wsJe6IISeOm5dlILfzLUg=
forge.chapril.org/mls-361/logger v0.0.0-20210511132528-884fa4c98c68/go.mod h1:R/JAwND755VIZ+uTkwqtgY3GmPzS+Nn8NKXPXBr2JwQ=
forge.chapril.org/mls-361/uuid v0.0.0-20210511091055-533cd6b13c6f h1:ycJeyJjfkgEaiiNmOKd74Jir+qtlGlB17Dstvi1KekQ=
forge.chapril.org/mls-361/uuid v0.0.0-20210511091055-533cd6b13c6f/go.mod h1:OAYM+f6ErfC4jbruuG2crA5W7YSpr7+wEs2MrxIzR3Q=
github.com/jinzhu/copier v0.3.0 h1:P5zN9OYSxmtzZmwgcVmt5Iu8egfP53BGMPAFgEksKPI=

13
internal/config/data/logger.go

@ -7,14 +7,15 @@
package data
const (
_defaultLoggerLevel = "trace"
_defaultLoggerLevel = "debug"
_defaultLoggerOutput = "stderr"
)
// Logger AFAIRE.
type Logger struct {
Level string
Output string
Level string
Output string
Facility string
}
func (l *Logger) validate() error {
@ -26,7 +27,11 @@ func (l *Logger) validate() error {
l.Output = _defaultLoggerOutput
}
//AFINIR
if l.Output == "syslog" {
if l.Facility == "" {
l.Facility = "local0"
}
}
return nil
}

20
internal/logger/logger.go

@ -12,7 +12,7 @@ import (
"forge.chapril.org/armen/armen/internal/components"
)
// AFAIRE.
// Build AFAIRE.
func Build(ccs *components.Components) (components.Logger, error) {
app := ccs.Application
cfg := ccs.Config.Logger()
@ -23,7 +23,23 @@ func Build(ccs *components.Components) (components.Logger, error) {
level = "trace"
}
return logger.New(app.ID(), app.Name(), level, logger.NewOutputStderr())
var (
output logger.Output
err error
)
switch cfg.Output {
case "syslog":
output, err = logger.NewSyslogOutput(cfg.Facility, app.Name())
default:
output = logger.NewStderrOutput()
}
if err != nil {
return nil, err
}
return logger.New(app.ID(), app.Name(), level, output)
}
/*

Loading…
Cancel
Save