danaugrs преди 7 години
родител
ревизия
77ea848ccd

+ 5 - 3
camera/control/orbit_control.go

@@ -12,6 +12,7 @@ import (
 	"math"
 )
 
+// OrbitControl is a camera controller that allows orbiting a center point while looking at it.
 type OrbitControl struct {
 	Enabled         bool    // Control enabled state
 	EnableRotate    bool    // Rotate enabled state
@@ -109,6 +110,7 @@ func NewOrbitControl(icam camera.ICamera, win window.IWindow) *OrbitControl {
 	return oc
 }
 
+// Dispose unsubscribes from all events
 func (oc *OrbitControl) Dispose() {
 
 	// Unsubscribe to event handlers
@@ -142,21 +144,21 @@ func (oc *OrbitControl) Zoom(delta float32) {
 	oc.updateZoom()
 }
 
-// Rotate camera left by specified angle
+// RotateLeft rotates the camera left by specified angle
 func (oc *OrbitControl) RotateLeft(angle float32) {
 
 	oc.thetaDelta -= angle
 	oc.updateRotate()
 }
 
-// Rotate camera up by specified angle
+// RotateUp rotates the camera up by specified angle
 func (oc *OrbitControl) RotateUp(angle float32) {
 
 	oc.phiDelta -= angle
 	oc.updateRotate()
 }
 
-// Updates camera rotation from tethaDelta and phiDelta
+// Updates the camera rotation from thetaDelta and phiDelta
 func (oc *OrbitControl) updateRotate() {
 
 	const EPS = 0.01

+ 2 - 1
core/timer.go

@@ -8,12 +8,13 @@ import (
 	"time"
 )
 
+// TimerManager manages multiple timers
 type TimerManager struct {
 	nextID int       // next timer id
 	timers []timeout // list of timeouts
 }
 
-// Type for timer callback functions
+// TimerCallback is the type for timer callback functions
 type TimerCallback func(interface{})
 
 // Internal structure for each active timer

+ 17 - 14
geometry/geometry.go

@@ -9,13 +9,14 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
-// Interface for all geometries
+// IGeometry is the interface for all geometries.
 type IGeometry interface {
 	GetGeometry() *Geometry
 	RenderSetup(gs *gls.GLS)
 	Dispose()
 }
 
+// Geometry is a vertex based geometry.
 type Geometry struct {
 	refcount            int             // Current number of references
 	vbos                []*gls.VBO      // Array of VBOs
@@ -31,7 +32,7 @@ type Geometry struct {
 	boundingSphereValid bool            // Indicates if last calculated bounding sphere is valid
 }
 
-// Geometry group object
+// Group is a geometry group object.
 type Group struct {
 	Start    int    // Index of first element of the group
 	Count    int    // Number of elements in the group
@@ -39,6 +40,7 @@ type Group struct {
 	Matid    string // Material id used when loading external models
 }
 
+// NewGeometry creates and returns a pointer to a new Geometry.
 func NewGeometry() *Geometry {
 
 	g := new(Geometry)
@@ -46,7 +48,7 @@ func NewGeometry() *Geometry {
 	return g
 }
 
-// Init initializes the geometry
+// Init initializes the geometry.
 func (g *Geometry) Init() {
 
 	g.refcount = 1
@@ -90,19 +92,20 @@ func (g *Geometry) Dispose() {
 	g.Init()
 }
 
+// GetGeometry satisfies the IGeometry interface.
 func (g *Geometry) GetGeometry() *Geometry {
 
 	return g
 }
 
-// AddGroup adds a geometry group (for multimaterial)
+// AddGroup adds a geometry group (for multimaterial).
 func (g *Geometry) AddGroup(start, count, matIndex int) *Group {
 
 	g.groups = append(g.groups, Group{start, count, matIndex, ""})
 	return &g.groups[len(g.groups)-1]
 }
 
-// AddGroupList adds the specified list of groups to this geometry
+// AddGroupList adds the specified list of groups to this geometry.
 func (g *Geometry) AddGroupList(groups []Group) {
 
 	for _, group := range groups {
@@ -110,19 +113,19 @@ func (g *Geometry) AddGroupList(groups []Group) {
 	}
 }
 
-// GroupCount returns the number of geometry groups (for multimaterial)
+// GroupCount returns the number of geometry groups (for multimaterial).
 func (g *Geometry) GroupCount() int {
 
 	return len(g.groups)
 }
 
-// GroupAt returns pointer to geometry group at the specified index
+// GroupAt returns pointer to geometry group at the specified index.
 func (g *Geometry) GroupAt(idx int) *Group {
 
 	return &g.groups[idx]
 }
 
-// SetIndices sets the indices array for this geometry
+// SetIndices sets the indices array for this geometry.
 func (g *Geometry) SetIndices(indices math32.ArrayU32) {
 
 	g.indices = indices
@@ -131,13 +134,13 @@ func (g *Geometry) SetIndices(indices math32.ArrayU32) {
 	g.boundingSphereValid = false
 }
 
-// Indices returns this geometry indices array
+// Indices returns this geometry indices array.
 func (g *Geometry) Indices() math32.ArrayU32 {
 
 	return g.indices
 }
 
-// AddVBO adds a Vertex Buffer Object for this geometry
+// AddVBO adds a Vertex Buffer Object for this geometry.
 func (g *Geometry) AddVBO(vbo *gls.VBO) {
 
 	// Check that the provided VBO doesn't have conflicting attributes with existing VBOs
@@ -164,9 +167,9 @@ func (g *Geometry) VBO(attrib string) *gls.VBO {
 	return nil
 }
 
-// Returns the number of items in the first VBO
+// Items returns the number of items in the first VBO.
 // (The number of items should be same for all VBOs)
-// An item is a complete group of attributes in the VBO buffer
+// An item is a complete group of attributes in the VBO buffer.
 func (g *Geometry) Items() int {
 
 	if len(g.vbos) == 0 {
@@ -180,7 +183,7 @@ func (g *Geometry) Items() int {
 }
 
 // BoundingBox computes the bounding box of the geometry if necessary
-// and returns is value
+// and returns is value.
 func (g *Geometry) BoundingBox() math32.Box3 {
 
 	// If valid, returns its value
@@ -293,7 +296,7 @@ func (g *Geometry) ApplyMatrix(m *math32.Matrix4) {
 	vboNormals.Update()
 }
 
-// RenderSetup is called by the renderer before drawing the geometry
+// RenderSetup is called by the renderer before drawing the geometry.
 func (g *Geometry) RenderSetup(gs *gls.GLS) {
 
 	// First time initialization

+ 2 - 1
gls/uniform.go

@@ -8,6 +8,7 @@ import (
 	"fmt"
 )
 
+// Uniform represents an OpenGL uniform.
 type Uniform struct {
 	name      string // base name
 	nameIdx   string // cached indexed name
@@ -16,7 +17,7 @@ type Uniform struct {
 	lastIndex int32  // last index
 }
 
-// Init initializes this uniform location cache and sets its name
+// Init initializes this uniform location cache and sets its name.
 func (u *Uniform) Init(name string) {
 
 	u.name = name

+ 8 - 8
graphic/graphic.go

@@ -169,24 +169,24 @@ func (gr *Graphic) GetMaterial(vpos int) material.IMaterial {
 }
 
 // CalculateMatrices calculates the model view and model view projection matrices.
-func (g *Graphic) CalculateMatrices(gs *gls.GLS, rinfo *core.RenderInfo) {
+func (gr *Graphic) CalculateMatrices(gs *gls.GLS, rinfo *core.RenderInfo) {
 
 	// Calculate model view and model view projection matrices
-	mw := g.MatrixWorld()
-	g.mvm.MultiplyMatrices(&rinfo.ViewMatrix, &mw)
-	g.mvpm.MultiplyMatrices(&rinfo.ProjMatrix, &g.mvm)
+	mw := gr.MatrixWorld()
+	gr.mvm.MultiplyMatrices(&rinfo.ViewMatrix, &mw)
+	gr.mvpm.MultiplyMatrices(&rinfo.ProjMatrix, &gr.mvm)
 }
 
 // ModelViewMatrix returns the last cached model view matrix for this graphic.
-func (g *Graphic) ModelViewMatrix() *math32.Matrix4 {
+func (gr *Graphic) ModelViewMatrix() *math32.Matrix4 {
 
-	return &g.mvm
+	return &gr.mvm
 }
 
 // ModelViewProjectionMatrix returns the last cached model view projection matrix for this graphic.
-func (g *Graphic) ModelViewProjectionMatrix() *math32.Matrix4 {
+func (gr *Graphic) ModelViewProjectionMatrix() *math32.Matrix4 {
 
-	return &g.mvpm
+	return &gr.mvpm
 }
 
 // GetMaterial returns the material associated with the GraphicMaterial.

+ 2 - 1
gui/align.go

@@ -4,9 +4,10 @@
 
 package gui
 
-// Align specifies the alignment of an object inside another
+// Align specifies the alignment of an object inside another.
 type Align int
 
+// The various types of alignment.
 const (
 	AlignNone   = Align(iota) // No alignment
 	AlignLeft                 // Align horizontally at left

+ 4 - 4
gui/assets/data.go

@@ -86,7 +86,7 @@ func fontsFreemonoTtf() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "fonts/FreeMono.ttf", size: 592632, mode: os.FileMode(436), modTime: time.Unix(1512153466, 0)}
+	info := bindataFileInfo{name: "fonts/FreeMono.ttf", size: 592632, mode: os.FileMode(438), modTime: time.Unix(1515256752, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -106,7 +106,7 @@ func fontsFreesansTtf() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "fonts/FreeSans.ttf", size: 1563256, mode: os.FileMode(436), modTime: time.Unix(1512153466, 0)}
+	info := bindataFileInfo{name: "fonts/FreeSans.ttf", size: 1563256, mode: os.FileMode(438), modTime: time.Unix(1515256752, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -126,7 +126,7 @@ func fontsFreesansboldTtf() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "fonts/FreeSansBold.ttf", size: 416128, mode: os.FileMode(436), modTime: time.Unix(1512153466, 0)}
+	info := bindataFileInfo{name: "fonts/FreeSansBold.ttf", size: 416128, mode: os.FileMode(438), modTime: time.Unix(1515256752, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -146,7 +146,7 @@ func fontsMaterialiconsRegularTtf() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "fonts/MaterialIcons-Regular.ttf", size: 128180, mode: os.FileMode(436), modTime: time.Unix(1512153466, 0)}
+	info := bindataFileInfo{name: "fonts/MaterialIcons-Regular.ttf", size: 128180, mode: os.FileMode(438), modTime: time.Unix(1515256752, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }

+ 1 - 0
gui/assets/icon/icodes.go

@@ -5,6 +5,7 @@
 
 package icon
 
+// Icon constants.
 const (
 	N3dRotation                           = string(0xe84d)
 	AcUnit                                = string(0xeb3b)

+ 2 - 2
gui/button.go

@@ -32,10 +32,10 @@ type Button struct {
 	pressed   bool          // true if button is pressed
 }
 
-// Button style
+// ButtonStyle contains the styling of a Button
 type ButtonStyle BasicStyle
 
-// All Button styles
+// ButtonStyles contains one ButtonStyle for each possible button state
 type ButtonStyles struct {
 	Normal   ButtonStyle
 	Over     ButtonStyle

+ 1 - 0
gui/docklayout.go

@@ -13,6 +13,7 @@ type DockLayoutParams struct {
 	Edge int
 }
 
+// The different types of docking.
 const (
 	DockTop = iota + 1
 	DockRight

+ 1 - 0
gui/gridlayout.go

@@ -1,6 +1,7 @@
 // Copyright 2016 The G3N Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
+
 package gui
 
 // GridLayout is a panel layout which arranges its children in a rectangular grid.

+ 5 - 3
gui/image_button.go

@@ -21,20 +21,22 @@ type ImageButton struct {
 	stateImages [ButtonDisabled + 1]*texture.Texture2D // array of images for each button state
 }
 
+// ButtonState specifies a button state.
 type ButtonState int
 
+// The possible button states.
 const (
 	ButtonNormal ButtonState = iota
 	ButtonOver
-	//ButtonFocus
 	ButtonPressed
 	ButtonDisabled
+	// ButtonFocus
 )
 
-// ImageButton style
+// ImageButtonStyle contains the styling of an ImageButton.
 type ImageButtonStyle BasicStyle
 
-// All ImageButton styles
+// ImageButtonStyles contains one ImageButtonStyle for each possible ImageButton state.
 type ImageButtonStyles struct {
 	Normal   ImageButtonStyle
 	Over     ImageButtonStyle

+ 1 - 1
gui/imagelabel.go

@@ -29,7 +29,7 @@ type ImageLabel struct {
 	icon  *Label // optional internal icon label
 }
 
-// ImageLabelStyle
+// ImageLabelStyle contains the styling of an ImageLabel.
 type ImageLabelStyle BasicStyle
 
 // NewImageLabel creates and returns a pointer to a new image label widget

+ 1 - 1
gui/label.go

@@ -35,7 +35,7 @@ func NewLabel(text string) *Label {
 	return NewLabelWithFont(text, StyleDefault().Font)
 }
 
-// NewLabel creates and returns a label panel with
+// NewIcon creates and returns a label panel with
 // the specified text drawn using the default icon font.
 func NewIcon(icon string) *Label {
 	return NewLabelWithFont(icon, StyleDefault().FontIcon)

+ 3 - 3
gui/list.go

@@ -29,13 +29,13 @@ type ListItem struct {
 	list        *List   // Pointer to list
 }
 
-// ListStyles
+// ListStyles encapsulates a set of styles for the list and item.
 type ListStyles struct {
 	Scroller *ItemScrollerStyles
 	Item     *ListItemStyles
 }
 
-// ListItemStyles
+// ListItemStyles contains one ListItemStyle for each possible item state.
 type ListItemStyles struct {
 	Normal      ListItemStyle
 	Over        ListItemStyle
@@ -44,7 +44,7 @@ type ListItemStyles struct {
 	SelHigh     ListItemStyle
 }
 
-// ListItemStyle
+// ListItemStyle contains the styling of a list item.
 type ListItemStyle BasicStyle
 
 // OnListItemResize is the identifier of the event dispatched when a ListItem's child panel is resized

+ 1 - 0
gui/menu.go

@@ -12,6 +12,7 @@ import (
 	"time"
 )
 
+// Menu is the menu GUI element
 type Menu struct {
 	Panel                // embedded panel
 	styles   *MenuStyles // pointer to current styles

+ 2 - 1
gui/root.go

@@ -25,6 +25,7 @@ type Root struct {
 	targets           []IPanel       // preallocated list of target panels
 }
 
+// Types of event propagation stopping.
 const (
 	StopGUI = 0x01             // Stop event propagation to GUI
 	Stop3D  = 0x02             // Stop event propagation to 3D
@@ -164,7 +165,7 @@ func (r *Root) SetCursorText() {
 	r.win.SetStandardCursor(window.IBeamCursor)
 }
 
-// SetCursorText sets the cursor over the associated window to the crosshair type.
+// SetCursorCrosshair sets the cursor over the associated window to the crosshair type.
 func (r *Root) SetCursorCrosshair() {
 
 	r.win.SetStandardCursor(window.CrosshairCursor)

+ 4 - 1
gui/scroller.go

@@ -27,9 +27,10 @@ type Scroller struct {
 	modKeyPressed bool           // Modifier key is pressed
 }
 
-// ScrollMode specifies which scroll directions are allowed
+// ScrollMode specifies which scroll directions are allowed.
 type ScrollMode int
 
+// The various scroll modes.
 const (
 	ScrollNone       = ScrollMode(0x00)                              // No scrolling allowed
 	ScrollVertical   = ScrollMode(0x01)                              // Vertical scrolling allowed
@@ -40,6 +41,7 @@ const (
 // ScrollbarInterlocking specifies what happens where the vertical and horizontal scrollbars meet.
 type ScrollbarInterlocking int
 
+// The three scrollbar interlocking types.
 const (
 	ScrollbarInterlockingNone       = ScrollbarInterlocking(iota) // No scrollbar interlocking
 	ScrollbarInterlockingVertical                                 // Vertical scrollbar takes precedence
@@ -51,6 +53,7 @@ const (
 // For the horizontal scrollbar it specifies whether it's added to the top or to the bottom.
 type ScrollbarPosition int
 
+// The four possible scrollbar positions.
 const (
 	ScrollbarLeft   = ScrollbarPosition(iota) // Scrollbar is positioned on the left of the scroller
 	ScrollbarRight                            // Scrollbar is positioned on the right of the scroller

+ 1 - 1
gui/style_dark.go

@@ -11,7 +11,7 @@ import (
 	"github.com/g3n/engine/text"
 )
 
-// NewLightStyle creates and returns a pointer to the a new "light" style
+// NewDarkStyle creates and returns a pointer to the a new "dark" style
 func NewDarkStyle() *Style {
 
 	// Fonts to use

+ 8 - 9
gui/table.go

@@ -16,16 +16,17 @@ import (
 )
 
 const (
-	// Name of the event generated when the table is right or left clicked
+	// OnTableClick is the event generated when the table is right or left clicked
 	// Parameter is TableClickEvent
 	OnTableClick = "onTableClick"
-	// Name of the event generated when the table row count changes (no parameters)
+	// OnTableRowCount is the event generated when the table row count changes (no parameters)
 	OnTableRowCount = "onTableRowCount"
 )
 
 // TableSortType is the type used to specify the sort method for a table column
 type TableSortType int
 
+// The various sorting types
 const (
 	TableSortNone TableSortType = iota
 	TableSortString
@@ -36,9 +37,9 @@ const (
 type TableSelType int
 
 const (
-	// Single row selection mode (default)
-	TableSelSingleRow = iota
-	// Multiple row selection mode
+	// TableSelSingleRow is the single row selection mode (default)
+	TableSelSingleRow TableSelType = iota
+	// TableSelMultiRow is the multiple row selection mode
 	TableSelMultiRow
 )
 
@@ -1615,9 +1616,8 @@ func (ts tableSortString) Less(i, j int) bool {
 	sj := fmt.Sprintf(ts.format, vj)
 	if ts.asc {
 		return si < sj
-	} else {
-		return sj < si
 	}
+	return sj < si
 }
 
 // tableSortNumber is an internal type implementing the sort.Interface
@@ -1638,9 +1638,8 @@ func (ts tableSortNumber) Less(i, j int) bool {
 	nj := cv2f64(vj)
 	if ts.asc {
 		return ni < nj
-	} else {
-		return nj < ni
 	}
+	return nj < ni
 }
 
 // Try to convert an interface value to a float64 number

+ 1 - 0
gui/window.go

@@ -64,6 +64,7 @@ type WindowStyles struct {
 // ResizeBorders specifies which window borders can be resized
 type ResizeBorders int
 
+// Resizing can be allowed or disallowed on each window edge
 const (
 	ResizeTop = ResizeBorders(1 << (iota + 1))
 	ResizeRight

+ 1 - 0
light/directional.go

@@ -12,6 +12,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Directional represents a directional, positionless light
 type Directional struct {
 	core.Node              // Embedded node
 	color     math32.Color // Light color

+ 1 - 1
material/physical.go

@@ -118,9 +118,9 @@ func (m *Physical) SetMetallicRoughnessMap(tex *texture.Texture2D) *Physical {
 	return m
 }
 
-// TODO add SetNormalMap (and SetSpecularMap) to StandardMaterial.
 // SetNormalMap sets this material optional normal texture.
 // Returns pointer to this updated material.
+// TODO add SetNormalMap (and SetSpecularMap) to StandardMaterial.
 func (m *Physical) SetNormalMap(tex *texture.Texture2D) *Physical {
 
 	m.normalTex = tex

+ 1 - 0
math32/frustum.go

@@ -9,6 +9,7 @@ type Frustum struct {
 	planes []Plane
 }
 
+// NewFrustumFromMatrix creates and returns a Frustum based on the provided matrix
 func NewFrustumFromMatrix(m *Matrix4) *Frustum {
 	f := new(Frustum)
 	f.planes = make([]Plane, 6)

+ 2 - 2
renderer/renderer.go

@@ -310,9 +310,9 @@ func (r *Renderer) renderScene(iscene core.INode, icam camera.ICamera) error {
 
 				if backToFront {
 					return g1pos.Z < g2pos.Z
-				} else {
-					return g1pos.Z > g2pos.Z
 				}
+
+				return g1pos.Z > g2pos.Z
 			})
 		}
 

+ 1 - 0
tools/g3nicodes/main.go

@@ -153,6 +153,7 @@ const templText = `// File generated by g3nicodes. Do not edit.
 
 package {{.Packname}}
 
+// Icon constants.
 const (
 	{{range .Consts}}
 		{{.Name}} = string({{.Value}})

+ 2 - 1
tools/g3nshaders/main.go

@@ -24,6 +24,7 @@ import (
 	"text/template"
 )
 
+// Program constants.
 const (
 	PROGNAME      = "g3nshaders"
 	VMAJOR        = 0
@@ -36,7 +37,7 @@ const (
 )
 
 //
-// Go template to generate the output file with the shaders' sources and
+// TEMPLATE is a Go template to generate the output file with the shaders' sources and
 // maps describing the include and shader names and programs shaders.
 //
 const TEMPLATE = `// File generated by G3NSHADERS. Do not edit.

+ 2 - 1
util/logger/console.go

@@ -38,7 +38,7 @@ var colorMap = map[int]string{
 	FATAL: bmagenta,
 }
 
-// logger Console writer type
+// Console is a console writer used for logging.
 type Console struct {
 	writer *os.File
 	color  bool
@@ -52,6 +52,7 @@ func NewConsole(color bool) *Console {
 	return &Console{os.Stdout, color}
 }
 
+// Write writes the provided logger event to the console.
 func (w *Console) Write(event *Event) {
 
 	if w.color {

+ 5 - 0
util/logger/file.go

@@ -8,10 +8,12 @@ import (
 	"os"
 )
 
+// File is a file writer used for logging.
 type File struct {
 	writer *os.File
 }
 
+// NewFile creates and returns a pointer to a new File object along with any error that occurred.
 func NewFile(filename string) (*File, error) {
 
 	file, err := os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
@@ -21,17 +23,20 @@ func NewFile(filename string) (*File, error) {
 	return &File{file}, nil
 }
 
+// Write writes the provided logger event to the file.
 func (f *File) Write(event *Event) {
 
 	f.writer.Write([]byte(event.fmsg))
 }
 
+// Close closes the file.
 func (f *File) Close() {
 
 	f.writer.Close()
 	f.writer = nil
 }
 
+// Sync commits the current contents of the file to stable storage.
 func (f *File) Sync() {
 
 	f.writer.Sync()

+ 10 - 10
util/logger/logger.go

@@ -38,11 +38,11 @@ const (
 var levelNames = [...]string{"DEBUG", "INFO", "WARN", "ERROR", "FATAL"}
 
 // Default logger and global mutex
-var Default *Logger = nil
+var Default *Logger
 var rootLoggers = []*Logger{}
 var mutex sync.Mutex
 
-// Interface for all logger writers
+// LoggerWriter is the interface for all logger writers
 type LoggerWriter interface {
 	Write(*Event)
 	Close()
@@ -61,7 +61,7 @@ type Logger struct {
 	children []*Logger
 }
 
-// Logger event passed from the logger to its writers.
+// Event is a logger event passed from the logger to its writers.
 type Event struct {
 	time    time.Time
 	level   int
@@ -76,7 +76,7 @@ func init() {
 	Default.AddWriter(NewConsole(false))
 }
 
-// New() creates and returns a new logger with the specified name.
+// New creates and returns a new logger with the specified name.
 // If a parent logger is specified, the created logger inherits the
 // parent's configuration.
 func New(name string, parent *Logger) *Logger {
@@ -177,21 +177,21 @@ func (l *Logger) Info(format string, v ...interface{}) {
 }
 
 // Warn emits a WARN level log message
-func (self *Logger) Warn(format string, v ...interface{}) {
+func (l *Logger) Warn(format string, v ...interface{}) {
 
-	self.Log(WARN, format, v...)
+	l.Log(WARN, format, v...)
 }
 
 // Error emits an ERROR level log message
-func (self *Logger) Error(format string, v ...interface{}) {
+func (l *Logger) Error(format string, v ...interface{}) {
 
-	self.Log(ERROR, format, v...)
+	l.Log(ERROR, format, v...)
 }
 
 // Fatal emits a FATAL level log message
-func (self *Logger) Fatal(format string, v ...interface{}) {
+func (l *Logger) Fatal(format string, v ...interface{}) {
 
-	self.Log(FATAL, format, v...)
+	l.Log(FATAL, format, v...)
 }
 
 // Log emits a log message with the specified level

+ 4 - 0
util/logger/net.go

@@ -8,10 +8,12 @@ import (
 	"net"
 )
 
+// Net is a network writer used for logging.
 type Net struct {
 	conn net.Conn
 }
 
+// NewNet creates and returns a pointer to a new Net object along with any error that occurred.
 func NewNet(network string, address string) (*Net, error) {
 
 	n := new(Net)
@@ -23,11 +25,13 @@ func NewNet(network string, address string) (*Net, error) {
 	return n, nil
 }
 
+// Write writes the provided logger event to the network.
 func (n *Net) Write(event *Event) {
 
 	n.conn.Write([]byte(event.fmsg))
 }
 
+// Clone closes the network connection.
 func (n *Net) Close() {
 
 	n.conn.Close()