ALog.3 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .TH "ALog" 3 "Mon Jul 11 2022" "openPilotLog" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. ALog \- The \fBALog\fP namespace encapsulates constants and functions used to provide logging to files and logging to console (stdout)
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Functions"
  10. .in +1c
  11. .ti -1c
  12. .RI "void \fBsetLogFileName\fP ()"
  13. .br
  14. .RI "setLogFileName sets a log file name ('Log_<Date>_<Time>\&.txt') "
  15. .ti -1c
  16. .RI "void \fBdeleteOldLogs\fP ()"
  17. .br
  18. .RI "Cleans up old logs and initializes logging by preparing and installing a QMessageHandler\&. "
  19. .ti -1c
  20. .RI "bool \fBinit\fP (bool log_debug)"
  21. .br
  22. .RI "initialise logging, clean up logfiles and install a QMessageHandler\&. To enable logging of debug messages, pass parameter as true\&. "
  23. .ti -1c
  24. .RI "void \fBaMessageHandler\fP (QtMsgType type, const QMessageLogContext &context, const QString &msg)"
  25. .br
  26. .RI "aMessageHandler Intercepts Messages and prints to console and log file "
  27. .in -1c
  28. .SH "Detailed Description"
  29. .PP
  30. The \fBALog\fP namespace encapsulates constants and functions used to provide logging to files and logging to console (stdout)
  31. The console output is color coded - green, amber, magenta for info, warn and crit messages, whereas the log files are just plain text\&.
  32. .PP
  33. There is a maximum of <numberOfLogs> log files with a maximum size of <sizeOfLogs>, at the moment, up to 10 logs of up to 100kB in size are kept, older logs are automatically deleted\&.
  34. .PP
  35. Debug output is not written to the logfile\&.
  36. .PP
  37. In order to start logging, the \fBALog::init()\fP function has to be called
  38. .PP
  39. Credits to \fCAndy Dunkel\fP for his excellent blog post on Qt Log File Rotation!
  40. .SH "Function Documentation"
  41. .PP
  42. .SS "void ALog::aMessageHandler (QtMsgType type, const QMessageLogContext & context, const QString & msg)"
  43. .PP
  44. aMessageHandler Intercepts Messages and prints to console and log file The message handler is responsible for intercepting the output from qDebug(), qInfo(), qWarning() and qCritical(), formatting them and printing them to the standard console out and to a logfile using QTextStream\&. Debug messages are not written to the log file\&.
  45. .SH "Author"
  46. .PP
  47. Generated automatically by Doxygen for openPilotLog from the source code\&.