<commit_before>/*
Package httplog provides logging functionality that is more geared towards existing inside of an HTTP handler.

It provides 9 methods that you likely expect from a logger, which are exactly the same the ones in Go's
built-in "log" package. Namely: Fatal, Fatalf, Fatalln, Panic, Panicf, Panicln, Print, Printf and Println.

So, for example, you are able to do things such as:

	func (handler *internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
		
		httplogger := httplog.New(io.Writer, true)
		
		httplog.Print("ServeHTTP() BEGIN")
		
		// ...
		
		httplog.Print("ServeHTTP() END")
	}

Which should be very familiar to anyone who has used Go's built in "log" package.

However, httplog also provides 25 methods (that the Go's built-in "log" package does NOT have) that makes it
easier to return a 4xx or 5xx HTTP response.

So, for example, you are able to do things such as:

	func (handler *internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
		
		httplogger := httplog.New(io.Writer, true)
		
		// ...
		
		if nil != err {
			httplogger.Printf("Received an error: %v", err)
			httplogger.InternalServerError(w)
			return
		}
		
		// ...
	}

The usage of the InternalServerError method in the example (as well as any of the other 24 of the 25 methods
that make it easier to return a 4xx or 5xx HTTP response) will completely deal with send the HTTP response
over the 'http.ResponseWriter'.


*/
package httplog
<commit_msg>added more documentation<commit_after>/*
Package httplog provides logging functionality that is more geared towards existing inside of an HTTP handler.

It provides 9 methods that you likely expect from a logger, which are exactly the same the ones in Go's
built-in "log" package. Namely: Fatal, Fatalf, Fatalln, Panic, Panicf, Panicln, Print, Printf and Println.

So, for example, you are still able to do things such as:

	func (handler *internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
		
		httplogger := httplog.New(io.Writer, true)
		
		httplog.Print("ServeHTTP() BEGIN")
		
		// ...
		
		httplog.Print("ServeHTTP() END")
	}

Which should be very familiar to anyone who has used Go's built in "log" package.

However, httplog also provides 25 methods (that Go's built-in "log" package does NOT have) that makes it
easier to return a 4xx or 5xx HTTP response.

So, for example, you are able to do things such as:

	func (handler *internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
		
		httplogger := httplog.New(io.Writer, true)
		
		// ...
		
		if nil != err {
			httplogger.Printf("Received an error: %v", err)
			httplogger.InternalServerError(w)
			return
		}
		
		// ...
	}

The usage of the InternalServerError method in this example (as well as any of the other 24 of the 25 methods
that make it easier to return a 4xx or 5xx HTTP response) will completely deal with sending the HTTP response
over the 'http.ResponseWriter'.

The other important feature is that if the 'http logger' was created with its 'dumpLogs' parameters set to 'true'.
So, for example:

	httplogger := httplog.New(os.Stdout, true)

Then in the header of the HTTP response sent with any of the 25 methods (that make it easier to return a 4xx or 5xx
HTTP response), such as InternalServerError, NotFound, Unauthorized, NotImplemented, etc, you will get the logs dumped
using HTTP response headers that look like:

	x-Log.000: ServeHTTP() BEGIN
	x-Log.001: ServeHTTP() Received, subject = "This weekend?"
	x-Log.002: ServeHTTP() Received, body    = "Hey,\nLet's go to White Pine this weekend. Ok?"
	x-Log.003: ServeHTTP() Received, to      = ""
	x-Log.004: ServeHTTP() user_id = 5
	x-Log.005: ServeHTTP() Client Error: "to" is empty but is NOT allowed to be.
*/
package httplog

{'fraction_non_alphanumeric': 0.08797032326444092, 'fraction_numerical': 0.01192368839427663, 'mean_word_length': 3.8027989821882953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2022907', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1124, 'n_words': 506}