chore: apply gofmt formatting

This commit is contained in:
Houmgaor
2026-02-06 13:02:38 +01:00
parent 09f829f8be
commit 4960c5cb5d
16 changed files with 159 additions and 148 deletions

View File

@@ -9,6 +9,7 @@
// Packet Structure: // Packet Structure:
// //
// MHF packets follow this wire format: // MHF packets follow this wire format:
//
// [2 bytes: Opcode][N bytes: Packet-specific data][2 bytes: Footer 0x00 0x10] // [2 bytes: Opcode][N bytes: Packet-specific data][2 bytes: Footer 0x00 0x10]
// //
// Each packet type defines its own structure matching the binary format expected // Each packet type defines its own structure matching the binary format expected

View File

@@ -311,4 +311,3 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
}) })
} }
} }

View File

@@ -61,6 +61,7 @@ type ConnectionStats struct {
// - v: Verbose output including objects and stage changes // - v: Verbose output including objects and stage changes
// //
// Examples: // Examples:
//
// runConnections([]string{"-stats"}) // runConnections([]string{"-stats"})
// runConnections([]string{"-sessions", "-v"}) // runConnections([]string{"-sessions", "-v"})
// runConnections([]string{"-player", "Sarah", "-sessions"}) // runConnections([]string{"-player", "Sarah", "-sessions"})

View File

@@ -44,6 +44,7 @@ type ErrorGroup struct {
// - detailed: Show detailed information including examples and extra data // - detailed: Show detailed information including examples and extra data
// //
// Examples: // Examples:
//
// runErrors([]string{"-summary"}) // runErrors([]string{"-summary"})
// runErrors([]string{"-detailed", "-stack"}) // runErrors([]string{"-detailed", "-stack"})
// runErrors([]string{"-group", "caller", "-limit", "20"}) // runErrors([]string{"-group", "caller", "-limit", "20"})

View File

@@ -23,6 +23,7 @@ import (
// All filters are combined with AND logic. // All filters are combined with AND logic.
// //
// Examples: // Examples:
//
// runFilter([]string{"-level", "error"}) // runFilter([]string{"-level", "error"})
// runFilter([]string{"-since", "1h", "-logger", "channel-4*"}) // runFilter([]string{"-since", "1h", "-logger", "channel-4*"})
// runFilter([]string{"-msg", "connection reset", "-count"}) // runFilter([]string{"-msg", "connection reset", "-count"})
@@ -137,6 +138,7 @@ func runFilter(args []string) {
// - true if the string matches the pattern, false otherwise // - true if the string matches the pattern, false otherwise
// //
// Examples: // Examples:
//
// matchWildcard("channel-4", "channel-*") // returns true // matchWildcard("channel-4", "channel-*") // returns true
// matchWildcard("main.channel-4.error", "*channel-4*") // returns true // matchWildcard("main.channel-4.error", "*channel-4*") // returns true
// matchWildcard("test", "foo*") // returns false // matchWildcard("test", "foo*") // returns false

View File

@@ -16,6 +16,7 @@ import (
// - tail: Follow logs in real-time (like tail -f) // - tail: Follow logs in real-time (like tail -f)
// //
// Usage: // Usage:
//
// loganalyzer <command> [options] // loganalyzer <command> [options]
// loganalyzer filter -level error -since 1h // loganalyzer filter -level error -since 1h
// loganalyzer errors -summary // loganalyzer errors -summary

View File

@@ -50,6 +50,7 @@ type LogEntry struct {
// - An error if the file cannot be opened or read // - An error if the file cannot be opened or read
// //
// Example: // Example:
//
// entries, err := ParseLogFile("erupe.log") // entries, err := ParseLogFile("erupe.log")
// if err != nil { // if err != nil {
// log.Fatal(err) // log.Fatal(err)
@@ -106,6 +107,7 @@ func ParseLogFile(filename string) ([]*LogEntry, error) {
// - A LogEntry pointer containing the parsed data, or nil if the line is invalid // - A LogEntry pointer containing the parsed data, or nil if the line is invalid
// //
// Example: // Example:
//
// entry := ParseLogLine(`{"level":"info","ts":1762989571.547817,"msg":"Starting"}`) // entry := ParseLogLine(`{"level":"info","ts":1762989571.547817,"msg":"Starting"}`)
// fmt.Println(entry.Level, entry.Message) // fmt.Println(entry.Level, entry.Message)
func ParseLogLine(line string) *LogEntry { func ParseLogLine(line string) *LogEntry {
@@ -201,6 +203,7 @@ func ParseLogLine(line string) *LogEntry {
// - An error if the file cannot be opened, read, or if the callback returns an error // - An error if the file cannot be opened, read, or if the callback returns an error
// //
// Example: // Example:
//
// err := StreamLogFile("erupe.log", func(entry *LogEntry) error { // err := StreamLogFile("erupe.log", func(entry *LogEntry) error {
// if entry.Level == "error" { // if entry.Level == "error" {
// fmt.Println(entry.Message) // fmt.Println(entry.Message)
@@ -259,6 +262,7 @@ func StreamLogFile(filename string, callback func(*LogEntry) error) error {
// - A formatted string representation of the log entry // - A formatted string representation of the log entry
// //
// Example: // Example:
//
// formatted := FormatLogEntry(entry, true) // formatted := FormatLogEntry(entry, true)
// fmt.Println(formatted) // fmt.Println(formatted)
// // Output: 2025-11-12 23:19:31.546 INFO [main] Starting Erupe // // Output: 2025-11-12 23:19:31.546 INFO [main] Starting Erupe

View File

@@ -49,6 +49,7 @@ type LogStats struct {
// - detailed: Show detailed statistics including temporal patterns and top messages // - detailed: Show detailed statistics including temporal patterns and top messages
// //
// Examples: // Examples:
//
// runStats([]string{}) // Basic statistics // runStats([]string{}) // Basic statistics
// runStats([]string{"-detailed"}) // Full statistics with temporal analysis // runStats([]string{"-detailed"}) // Full statistics with temporal analysis
// runStats([]string{"-detailed", "-top", "20"}) // Show top 20 items // runStats([]string{"-detailed", "-top", "20"}) // Show top 20 items

View File

@@ -30,6 +30,7 @@ import (
// The follow mode polls the file every 100ms for new content. Use Ctrl+C to stop. // The follow mode polls the file every 100ms for new content. Use Ctrl+C to stop.
// //
// Examples: // Examples:
//
// runTail([]string{}) // Show last 10 lines and follow // runTail([]string{}) // Show last 10 lines and follow
// runTail([]string{"-n", "50"}) // Show last 50 lines and follow // runTail([]string{"-n", "50"}) // Show last 50 lines and follow
// runTail([]string{"-level", "error"}) // Only show errors // runTail([]string{"-level", "error"}) // Only show errors