feat(logs): by default, log server activity to a file.

This commit is contained in:
Houmgaor
2025-11-18 00:18:32 +01:00
parent 7aafc71dcc
commit 9a47a876eb
12 changed files with 132 additions and 16 deletions

View File

@@ -54,7 +54,7 @@ type ConnectionStats struct {
// - Provides verbose session details including objects and stage changes
//
// Options:
// - f: Path to log file (default: "erupe.log")
// - f: Path to log file (default: "logs/erupe.log")
// - player: Filter sessions by player name (case-insensitive substring match)
// - sessions: Show individual player sessions
// - stats: Show connection statistics (default: true)
@@ -67,7 +67,7 @@ type ConnectionStats struct {
func runConnections(args []string) {
fs := flag.NewFlagSet("connections", flag.ExitOnError)
logFile := fs.String("f", "erupe.log", "Path to log file")
logFile := fs.String("f", "logs/erupe.log", "Path to log file")
player := fs.String("player", "", "Filter by player name")
showSessions := fs.Bool("sessions", false, "Show individual player sessions")
showStats := fs.Bool("stats", true, "Show connection statistics")

View File

@@ -36,7 +36,7 @@ type ErrorGroup struct {
// - Tracks which callers produced each error
//
// Options:
// - f: Path to log file (default: "erupe.log")
// - f: Path to log file (default: "logs/erupe.log")
// - group: Group errors by "message", "caller", or "logger" (default: "message")
// - stack: Show stack traces in detailed view
// - limit: Maximum number of example entries per group (default: 10)
@@ -50,7 +50,7 @@ type ErrorGroup struct {
func runErrors(args []string) {
fs := flag.NewFlagSet("errors", flag.ExitOnError)
logFile := fs.String("f", "erupe.log", "Path to log file")
logFile := fs.String("f", "logs/erupe.log", "Path to log file")
groupBy := fs.String("group", "message", "Group errors by: message, caller, or logger")
showStack := fs.Bool("stack", false, "Show stack traces")
limit := fs.Int("limit", 10, "Limit number of examples per error group")

View File

@@ -29,7 +29,7 @@ import (
func runFilter(args []string) {
fs := flag.NewFlagSet("filter", flag.ExitOnError)
logFile := fs.String("f", "erupe.log", "Path to log file")
logFile := fs.String("f", "logs/erupe.log", "Path to log file")
level := fs.String("level", "", "Filter by log level (info, warn, error, fatal)")
logger := fs.String("logger", "", "Filter by logger name (supports wildcards)")
message := fs.String("msg", "", "Filter by message content (case-insensitive)")

View File

@@ -44,7 +44,7 @@ type LogStats struct {
// patterns, peak usage times, and potential issues.
//
// Options:
// - f: Path to log file (default: "erupe.log")
// - f: Path to log file (default: "logs/erupe.log")
// - top: Number of top items to show in detailed view (default: 10)
// - detailed: Show detailed statistics including temporal patterns and top messages
//
@@ -55,7 +55,7 @@ type LogStats struct {
func runStats(args []string) {
fs := flag.NewFlagSet("stats", flag.ExitOnError)
logFile := fs.String("f", "erupe.log", "Path to log file")
logFile := fs.String("f", "logs/erupe.log", "Path to log file")
topN := fs.Int("top", 10, "Show top N messages/loggers")
detailed := fs.Bool("detailed", false, "Show detailed statistics")

View File

@@ -21,7 +21,7 @@ import (
// Both phases support filtering by log level and colorized output.
//
// Options:
// - f: Path to log file (default: "erupe.log")
// - f: Path to log file (default: "logs/erupe.log")
// - n: Number of initial lines to show (default: 10)
// - follow: Whether to continue following the file (default: true)
// - level: Filter by log level (info, warn, error, fatal)
@@ -37,7 +37,7 @@ import (
func runTail(args []string) {
fs := flag.NewFlagSet("tail", flag.ExitOnError)
logFile := fs.String("f", "erupe.log", "Path to log file")
logFile := fs.String("f", "logs/erupe.log", "Path to log file")
lines := fs.Int("n", 10, "Number of initial lines to show")
follow := fs.Bool("follow", true, "Follow the log file (like tail -f)")
level := fs.String("level", "", "Filter by log level")