file_creator.cpp 668 B

12345678910111213141516171819202122
  1. #include "file_creator.h"
  2. #include "file.h"
  3. TFileLogBackendCreator::TFileLogBackendCreator(const TString& path /*= TString()*/, const TString& type /*= "file"*/)
  4. : TLogBackendCreatorBase(type)
  5. , Path(path)
  6. {}
  7. THolder<TLogBackend> TFileLogBackendCreator::DoCreateLogBackend() const {
  8. return MakeHolder<TFileLogBackend>(Path);
  9. }
  10. bool TFileLogBackendCreator::Init(const IInitContext& ctx) {
  11. ctx.GetValue("Path", Path);
  12. return !!Path;
  13. }
  14. ILogBackendCreator::TFactory::TRegistrator<TFileLogBackendCreator> TFileLogBackendCreator::Registrar("file");
  15. void TFileLogBackendCreator::DoToJson(NJson::TJsonValue& value) const {
  16. value["Path"] = Path;
  17. }