blob: a993d31f018e1937b10f5457af55110dca59a4a1 [file] [log] [blame]
James Kuszmaul011b67a2019-12-15 12:52:34 -08001#ifndef AOS_LOGGING_LOG_NAMER_H_
2#define AOS_LOGGING_LOG_NAMER_H_
3
Ravago Jones1a4bc762023-04-09 16:21:57 -07004#include <optional>
Philipp Schrader790cb542023-07-05 21:06:52 -07005#include <string>
James Kuszmaul011b67a2019-12-15 12:52:34 -08006
7namespace aos {
8namespace logging {
9// Returns the correct filename to log to, blocking until the usb drive
10// filesystem mounts, incrementing the number on the end of the filename, and
11// setting up a symlink at basename-current.
12// basename is the prefix to use for the logs within the usb drive. E.g., on a
13// typical roborio setup, calling GetLogName("abc") will return a filename of
14// the form "/media/sda1/abc-123" and setup a symlink pointing to it at
15// "/media/sda1/abc-current".
16std::string GetLogName(const char *basename);
Ravago Jones1a4bc762023-04-09 16:21:57 -070017
18// A nonblocking variant of GetLogName that you can poll instead of blocking for
19// the usb drive.
20std::optional<std::string> MaybeGetLogName(const char *basename);
21
James Kuszmaul011b67a2019-12-15 12:52:34 -080022} // namespace logging
23} // namespace aos
24
25#endif // AOS_LOGGING_LOG_NAMER_H_