summaryrefslogtreecommitdiff
path: root/src/ingestor.hpp
blob: 97ce9f9e7f36efcac9315791313faf81261c877b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include "logTypes.hpp"
#include <cstdio>
#include <scn/scan.h>

namespace WebStat {
	class Ingestor {
	public:
		using ScanResult = decltype(scn::scan<std::string_view, std::string_view, uint64_t, std::string_view,
				QuotedString, QueryString, std::string_view, unsigned short, unsigned int, unsigned int, CLFString,
				CLFString>(std::declval<std::string_view>(), ""));

		[[nodiscard]] static ScanResult scanLogLine(std::string_view);

		void ingestLog(std::FILE *);

	protected:
		size_t linesRead = 0;
		size_t linesParsed = 0;
		size_t linesDiscarded = 0;
	};
}