@srcds/log-parser
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

NPM version NPM downloads

log-parser SRCDS logs

Installation

Node.js 14.0.0 or newer is required

Yarn

yarn add @srcds/log-parser

NPM

npm i @srcds/log-parser

Example usage

import { parse } from '@srcds/log-parser';

async function run() {
	const parsed = parse('10/20/2020 - 10:30:50: "AttackerName<93><STEAM_1:0:12345><CT>" [698 2222 -69] killed "Lester<97><BOT><TERRORIST>" [1303 2143 64] with "hkp2000" (headshot)');

	console.log(parsed);
	// 	{
	// 	"type": "killed",
	// 	"receivedAt": "2020-10-19T23:30:50.000Z",
	// 	"payload": {
	// 		"attacker": {
	// 			"kind": "player",
	// 			"entityId": 93,
	// 			"playerId": "STEAM_1:0:12345",
	// 			"name": "AttackerName",
	// 			"team": {
	// 				"id": 3,
	// 				"name": "COUNTER_TERRORISTS"
	// 			},
	// 			"position": [698, 2222, -69]
	// 		},
	// 		"victim": {
	// 			"kind": "player",
	// 			"entityId": 97,
	// 			"playerId": "BOT",
	// 			"name": "Lester",
	// 			"team": {
	// 				"id": 2,
	// 				"name": "TERRORISTS"
	// 			},
	// 			"position": [1303, 2143, 64]
	// 		},
	// 		"weaponName": "hkp2000",
	// 		"modifiers": ["headshot"]
	// 	}
	// }
}

run().catch(console.log);

Dependents (0)

Package Sidebar

Install

npm i @srcds/log-parser

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

71.1 kB

Total Files

37

Last publish

Collaborators

  • negezor