blob: 0c32d5d1e27a2eb2f32aed4fa8c3ec1b57019464 [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
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -08007namespace aos::logging {
James Kuszmaul011b67a2019-12-15 12:52:34 -08008// Returns the correct filename to log to, blocking until the usb drive
9// filesystem mounts, incrementing the number on the end of the filename, and
10// setting up a symlink at basename-current.
11// basename is the prefix to use for the logs within the usb drive. E.g., on a
12// typical roborio setup, calling GetLogName("abc") will return a filename of
13// the form "/media/sda1/abc-123" and setup a symlink pointing to it at
14// "/media/sda1/abc-current".
15std::string GetLogName(const char *basename);
Ravago Jones1a4bc762023-04-09 16:21:57 -070016
17// A nonblocking variant of GetLogName that you can poll instead of blocking for
18// the usb drive.
19std::optional<std::string> MaybeGetLogName(const char *basename);
20
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080021} // namespace aos::logging
James Kuszmaul011b67a2019-12-15 12:52:34 -080022
23#endif // AOS_LOGGING_LOG_NAMER_H_