http_logger

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

This package provides a basic logger to log HTTP requests in the format that will be familiar to anyone who has ever used Apache. The logfiles are placed in the directory specified when the Http_Logger object is created. For now only Apache "Common Log Format" is supported, although this could be extended in the future. The logfiles themselves will always be named access.log.YYYYMMDD, and will be rolled daily.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Http_Logger

type Http_Logger struct {
	// contains filtered or unexported fields
}

An object that knows how to log requests in Apache format to a logfile. For the time being, only Apache "Common Log Format" (http://httpd.apache.org/docs/1.3/logs.html#common) is supported.

func Mk_Http_Logger

func Mk_Http_Logger(dir *string) (p *Http_Logger)

Make a Http_Logger object. Specify the directory where logfiles should be placed.

func (*Http_Logger) Close

func (f *Http_Logger) Close() (err error)

Closing the logfile making sure to close the logfile

func (*Http_Logger) Get_fname

func (f *Http_Logger) Get_fname() string

Get the filename to read the file

func (*Http_Logger) LogRequest

func (p *Http_Logger) LogRequest(in *http.Request, user string, code int, length int)

Log the HTTP request represented by in to the logfile. user should be the user who made the request, and code and length are the HTTP status code, and length of the response body.

func (*Http_Logger) Set_fname

func (f *Http_Logger) Set_fname(fname string) (err error)

Change file name if the user want to change the default filename

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL