RIT VEXU Core API
Loading...
Searching...
No Matches
logger.h
1#pragma once
2
3#include "vex/vex.h"
4#include <cstdarg>
5#include <cstdio>
6#include <string>
7
9enum LogLevel { DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME };
10
12class Logger {
13private:
14 const std::string filename;
15 vex::brain::sdcard sd;
16 void write_level(LogLevel l);
17
18public:
20 static constexpr int MAX_FORMAT_LEN = 512;
25 explicit Logger(const std::string &filename);
26
28 Logger(const Logger &l) = delete;
30 Logger &operator=(const Logger &l) = delete;
31
36 void Log(const std::string &s);
37
43 void Log(LogLevel level, const std::string &s);
44
49 void Logln(const std::string &s);
55 void Logln(LogLevel level, const std::string &s);
56
62 void Logf(const char *fmt, ...);
63
70 void Logf(LogLevel level, const char *fmt, ...);
71};
Logger & operator=(const Logger &l)=delete
copying not allowed
void Logf(const char *fmt,...)
Write a formatted string to the log.
Definition logger.cpp:51
void Log(const std::string &s)
Write a string to the log.
Definition logger.cpp:35
Logger(const std::string &filename)
Create a logger that will save to a file.
Definition logger.cpp:33
void Logln(const std::string &s)
Write a string and newline to the log.
Definition logger.cpp:41
static constexpr int MAX_FORMAT_LEN
maximum size for a string to be before it's written
Definition logger.h:20
Logger(const Logger &l)=delete
copying not allowed