From d7805555562bb399c93b8f11c3876759e3fe3abf Mon Sep 17 00:00:00 2001 From: mlabusch Date: Fri, 28 Apr 2017 10:14:59 +0200 Subject: [PATCH] [QS] comments --- lib/http/io_test.go | 4 ++-- lib/http/permission_test.go | 2 +- lib/log/log.go | 9 ++++++--- lib/log/log_test.go | 4 ++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/http/io_test.go b/lib/http/io_test.go index 325c4bb..3fd276e 100644 --- a/lib/http/io_test.go +++ b/lib/http/io_test.go @@ -13,7 +13,7 @@ import ( ) // 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) { assert := assert.New(t) @@ -38,7 +38,7 @@ func TestWrite(t *testing.T) { } // 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) { assert := assert.New(t) diff --git a/lib/http/permission_test.go b/lib/http/permission_test.go index e4e27f2..60a505d 100644 --- a/lib/http/permission_test.go +++ b/lib/http/permission_test.go @@ -12,7 +12,7 @@ import ( ) // 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) { assert := assert.New(t) diff --git a/lib/log/log.go b/lib/log/log.go index c9df52d..6fa8db8 100644 --- a/lib/log/log.go +++ b/lib/log/log.go @@ -1,3 +1,5 @@ +// Package log provides the +// functionality to start und initialize to logger package log import ( @@ -11,13 +13,14 @@ var Log *logger.Logger type Logger logger.Entry +// Function to initiate a new logger func init() { Log = logger.New() - // Enable fallback if core logger is used: - log.SetOutput(Log.Writer()) + log.SetOutput(Log.Writer()) // Enable fallback if core logger } -// 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 { ip := r.Header.Get("X-Forwarded-For") if len(ip) <= 1 { diff --git a/lib/log/log_test.go b/lib/log/log_test.go index 5e5e5c2..fc7cdc9 100644 --- a/lib/log/log_test.go +++ b/lib/log/log_test.go @@ -1,3 +1,5 @@ +// Package log provides the +// functionality to start und initialize to logger package log import ( @@ -7,6 +9,8 @@ import ( "github.com/stretchr/testify/assert" ) +// Function to test the logging +// Input: pointer to teh testing object func TestLog(t *testing.T) { assertion := assert.New(t)