fix(Logger): make buffer size user customizable
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (lgr *ConsoleLoggerImpl) init() {
|
func (lgr *ConsoleLoggerImpl) init() {
|
||||||
lgr.messages = make(chan string, logbuffersize)
|
lgr.messages = make(chan string, Logbuffersize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (logger *ConsoleLoggerImpl) StartLogger() {
|
func (logger *ConsoleLoggerImpl) StartLogger() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (lgr *FileLoggerImpl) init() {
|
func (lgr *FileLoggerImpl) init() {
|
||||||
lgr.filepath = "./log"
|
lgr.filepath = "./log"
|
||||||
lgr.messages = make(chan string, logbuffersize)
|
lgr.messages = make(chan string, Logbuffersize)
|
||||||
envfp, envexist := os.LookupEnv("LOGFILE_GO_LOGGER")
|
envfp, envexist := os.LookupEnv("LOGFILE_GO_LOGGER")
|
||||||
if envexist {
|
if envexist {
|
||||||
if len(envfp) > 0 {
|
if len(envfp) > 0 {
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
Assert "github.com/lbatuska/goutils/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Use this in the init() function to initialize the size of the buffered channel
|
// Use this in the init() function to initialize the size of the buffered channel
|
||||||
const logbuffersize int32 = 200
|
const Logbuffersize int32 = 200
|
||||||
|
|
||||||
var DEBUG bool = true
|
var DEBUG bool = true
|
||||||
|
|
||||||
@@ -27,6 +29,7 @@ func Create(instance Logger) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoggerInstance() Logger {
|
func LoggerInstance() Logger {
|
||||||
|
Assert.NotNil(loggerInstance)
|
||||||
return loggerInstance
|
return loggerInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user