refactor: naming (#1)

This commit was merged in pull request #1.
This commit is contained in:
Levente Nas
2024-09-25 09:42:06 +02:00
committed by GitHub
parent 23a8a9ee04
commit c4b6077e3a
11 changed files with 122 additions and 122 deletions

View File

@@ -14,19 +14,19 @@ const logbuffersize int32 = 200
var DEBUG bool = true
var (
loggerInstance LGRImpl
loggerInstance Logger
loggeronce sync.Once
loggerlogonce sync.Once
)
func Create(instance LGRImpl) {
func Create(instance Logger) {
loggeronce.Do(func() {
loggerInstance = instance
loggerInstance.init()
})
}
func Logger() LGRImpl {
func LoggerInstance() Logger {
return loggerInstance
}
@@ -42,7 +42,7 @@ func PrintJson[T any](entity *T) string {
func ExampleLogMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Logger().Write_DEBUG(fmt.Sprintf("\tRequest from: %s to: Host: %s URL: %s \tWith HEADERS: %s \tWith BODY: %s", r.RemoteAddr, r.Host, r.URL, r.Header, r.Body))
LoggerInstance().WriteDebug(fmt.Sprintf("\tRequest from: %s to: Host: %s URL: %s \tWith HEADERS: %s \tWith BODY: %s", r.RemoteAddr, r.Host, r.URL, r.Header, r.Body))
next.ServeHTTP(w, r)
})
}