rotating_file_creator.cpp 971 B

12345678910111213141516171819202122232425262728
  1. #include "rotating_file_creator.h"
  2. #include "rotating_file.h"
  3. THolder<TLogBackend> TRotatingFileLogBackendCreator::DoCreateLogBackend() const {
  4. return MakeHolder<TRotatingFileLogBackend>(Path, MaxSizeBytes, RotatedFilesCount);
  5. }
  6. TRotatingFileLogBackendCreator::TRotatingFileLogBackendCreator()
  7. : TFileLogBackendCreator("", "rotating")
  8. {}
  9. bool TRotatingFileLogBackendCreator::Init(const IInitContext& ctx) {
  10. if (!TFileLogBackendCreator::Init(ctx)) {
  11. return false;
  12. }
  13. ctx.GetValue("MaxSizeBytes", MaxSizeBytes);
  14. ctx.GetValue("RotatedFilesCount", RotatedFilesCount);
  15. return true;
  16. }
  17. ILogBackendCreator::TFactory::TRegistrator<TRotatingFileLogBackendCreator> TRotatingFileLogBackendCreator::Registrar("rotating");
  18. void TRotatingFileLogBackendCreator::DoToJson(NJson::TJsonValue& value) const {
  19. TFileLogBackendCreator::DoToJson(value);
  20. value["MaxSizeBytes"] = MaxSizeBytes;
  21. value["RotatedFilesCount"] = RotatedFilesCount;
  22. }