package
0.7.20
Repository: https://github.com/leighmacdonald/gbans.git
Documentation: pkg.go.dev

# README

logparse

The logparse library implements a parser for TF2 server logs, transforming them into statically typed structs.

This includes support for most of the extended output of the following plugins as well:

  • SupStats2
  • MedicStats

Match

The additional match functionality will tally up data and give summarized data in a format that is fairly similar to logs.tf.

package main

import (
	"fmt"
	"github.com/leighmacdonald/gbans/pkg/logparse"
	"github.com/pkg/errors"
)

func main() {
	parser := logparse.New()
	match := logparse.NewMatch(0, "Cool Server")
	logLines := make(chan string)

	go func() {
		// - tail log file from filesystem 
		// - read log file line by line
		// - read logs from a remote source using srcds UDP log listener
		// logLines <- "LOG LINE 1"
		// logLines <- "LOG LINE 2"
	}()

	for {
		line := <-logLines
		if line == "" {
			continue
		}

		result, errResult := parser.Parse(line)
		if errResult != nil {
			panic(errResult)
		}

		if err := match.Apply(result); err != nil && !errors.Is(err, logparse.ErrIgnored) {
			panic(fmt.Sprintf("Failed to Apply: %v [%d] %v", err, result.EventType, line))
		}
	}

}

# Functions

NewLogParser sets up a new log parser instance.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
nolint:gosec.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
?.
No description provided by the author
No description provided by the author
Fire suck extinguish.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
nolint:gosec.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IgnoredMsg is used for messages we are ignoring.
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
.
No description provided by the author
No description provided by the author
Finish off player.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Sandman.
huntsman.
Equalizer.
No description provided by the author
knife skewer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
No description provided by the author
UnknownMsg is for any unexpected message formats.
No description provided by the author
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
No description provided by the author
VOTE_FAILED_GENERIC - Generic "Vote Failed" message.
VOTE_FAILED_YES_MUST_EXCEED_NO - Yes votes must outnumber No votes.
VOTE_FAILED_QUORUM_FAILURE - Not Enough Votes.
No description provided by the author
No description provided by the author
Yes.
No.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Team "RED" triggered "Intermission_Win_Limit".
World triggered "Mini_Round_Length" (seconds "820.00").
World triggered "Mini_Round_Selected" (round "Round_A").
World triggered "Mini_Round_Start".
World triggered "Mini_Round_Win" (winner "Blue") (round "round_a").
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
World triggered "Round_Setup_Begin".
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

nolint:gochecknoglobals.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CVAREvt is emitted on a cvar change.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Match and its related Match* structs are designed as a close to 1:1 mirror of the logs.tf ui For a simple example of usage, see internal/cmd/stats.go TODO - individual game state cache to track who is on winning team - Track current player session - Track player playtime per class - Track server playtime per class - Track global playtime per class - Track player midfights won - Track player biggest killstreaks (min 18 players in server) - Track server biggest killstreaks (min 18 players in server) - Track global biggest killstreaks (min 18 players in server) - Track player classes killed - Track player classes killedBy - Track server classes killed - Track server classes killedBy - Track global classes killed - Track global classes killedBy - Track player weapon stats - Track server weapon stats - Track global weapon stats - Track current map to get correct map stats.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Pos is a position in 3D space.
RCONEvt is emitted on a rcon connection executing a command.
Results hold the results of parsing a log line.
No description provided by the author
ServerEvent is a flat struct encapsulating a parsed log event.
No description provided by the author
No description provided by the author
No description provided by the author
SourcePlayer represents the player who initiated the event.
No description provided by the author
No description provided by the author
No description provided by the author
TargetPlayer maps the common secondary player values name_2.
No description provided by the author
No description provided by the author
TimeStamp is the base event for all other events.
UDPLogListener handles reading inbound srcds log packets.
L 04/15/2024 - 22:38:57: Vote succeeded "Kick Pain in a Box".
L 04/15/2024 - 22:38:57: Kick Vote details: VoteInitiatorSteamID: [U:1:8169544] VoteTargetSteamID: [U:1:30511445] Valid: 1 BIndividual: 1 Name: Pain in a Box Proxy: 0.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
EventType defines a known, parsable message type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
LogStopEvt is the server shutting down the map and closing the log.
No description provided by the author
MedigunType holds which medigun a player was using goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
PickupItem is used for goland:noinspection GoUnnecessarilyExportedIdentifiers.
goland:noinspection GoUnnecessarilyExportedIdentifiers.
No description provided by the author
Team represents a players team, or spectator state.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author