[QS] comments
This commit is contained in:
parent
801148e7d0
commit
d780555556
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Function to test the writing into a http response
|
// Function to test the writing into a http response
|
||||||
// Input: pointer to testing object T
|
// Input: pointer to testing object
|
||||||
func TestWrite(t *testing.T) {
|
func TestWrite(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ func TestWrite(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to test the reading from a http response
|
// Function to test the reading from a http response
|
||||||
// Input: pointer to testing object T
|
// Input: pointer to testing object
|
||||||
func TestRead(t *testing.T) {
|
func TestRead(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Function to the the permission and it's error handling
|
// Function to the the permission and it's error handling
|
||||||
// Input: pointer to testing object T
|
// Input: pointer to testing object
|
||||||
func TestPermission(t *testing.T) {
|
func TestPermission(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Package log provides the
|
||||||
|
// functionality to start und initialize to logger
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -11,13 +13,14 @@ var Log *logger.Logger
|
||||||
|
|
||||||
type Logger logger.Entry
|
type Logger logger.Entry
|
||||||
|
|
||||||
|
// Function to initiate a new logger
|
||||||
func init() {
|
func init() {
|
||||||
Log = logger.New()
|
Log = logger.New()
|
||||||
// Enable fallback if core logger is used:
|
log.SetOutput(Log.Writer()) // Enable fallback if core logger
|
||||||
log.SetOutput(Log.Writer())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP to add information of a httprequest to log
|
// Function to add the information of a http request to the log
|
||||||
|
// Input: pointer to the http request r
|
||||||
func HTTP(r *http.Request) *logger.Entry {
|
func HTTP(r *http.Request) *logger.Entry {
|
||||||
ip := r.Header.Get("X-Forwarded-For")
|
ip := r.Header.Get("X-Forwarded-For")
|
||||||
if len(ip) <= 1 {
|
if len(ip) <= 1 {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Package log provides the
|
||||||
|
// functionality to start und initialize to logger
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -7,6 +9,8 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Function to test the logging
|
||||||
|
// Input: pointer to teh testing object
|
||||||
func TestLog(t *testing.T) {
|
func TestLog(t *testing.T) {
|
||||||
assertion := assert.New(t)
|
assertion := assert.New(t)
|
||||||
|
|
||||||
|
|
Reference in New Issue