LoggerFileRotating will write log messages to a file that is rotated at midnight.

space from the docs in code

LoggerFileRotating( const fs::path &folder, const std::string &formatStr, bool appendToExisting = true );

  • folder defines the root folder that will contain the logfile. If a blank string is provided, the folder will default to the folder that contains the application binary.
  • formatStr is the string that will be evaluated by strftime and turned into the logfile name. For example, the string cinder.%Y.%m.%d.log could evaluate to cinder.2015.08.28.log. Note that, since the log name is only re-evaluated once daily, using a format that includes minutes or seconds may not produce the results you're expecting. If a blank format string is provided, an assertion will be thrown.
  • appendToExisting configures file appending. This parameter defaults to true.




Public Member Functions

  • ~LoggerFileRotating ()
  • void
    write (const Metadata &meta, const std::string &text) override
  • void
    setTimestampEnabled (bool enable=true)
  • bool
    isTimestampEnabled () const
  • void
    setLevel (Level level)
  • getLevel () const

Protected Member Functions

  • void
    setFilePath (const fs::path &filepath)
  • fs::path
    getDefaultLogFilePath () const
  • void
    ensureDirectoryExists ()
  • void
    writeDefault (std::ostream &stream, const Metadata &meta, const std::string &text)

Protected Attributes

  • std::function< void(const fs::path &)>
    mFileChangeFn
  • fs::path
    mFolderPath
  • std::string
    mDailyFormatStr
  • int
    mYearDay
  • fs::path
    mFilePath
  • bool
    mAppend
  • std::ofstream
    mStream
  • mLevel