aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/file_creator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp/logger/file_creator.cpp')
-rw-r--r--library/cpp/logger/file_creator.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/cpp/logger/file_creator.cpp b/library/cpp/logger/file_creator.cpp
new file mode 100644
index 0000000000..0a84469e43
--- /dev/null
+++ b/library/cpp/logger/file_creator.cpp
@@ -0,0 +1,22 @@
+#include "file_creator.h"
+#include "file.h"
+
+TFileLogBackendCreator::TFileLogBackendCreator(const TString& path /*= TString()*/, const TString& type /*= "file"*/)
+ : TLogBackendCreatorBase(type)
+ , Path(path)
+{}
+
+THolder<TLogBackend> TFileLogBackendCreator::DoCreateLogBackend() const {
+ return MakeHolder<TFileLogBackend>(Path);
+}
+
+bool TFileLogBackendCreator::Init(const IInitContext& ctx) {
+ ctx.GetValue("Path", Path);
+ return !!Path;
+}
+
+ILogBackendCreator::TFactory::TRegistrator<TFileLogBackendCreator> TFileLogBackendCreator::Registrar("file");
+
+void TFileLogBackendCreator::DoToJson(NJson::TJsonValue& value) const {
+ value["Path"] = Path;
+}