summaryrefslogtreecommitdiff
path: root/i/marvin/src/log/logger.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/log/logger.cc')
-rw-r--r--i/marvin/src/log/logger.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/i/marvin/src/log/logger.cc b/i/marvin/src/log/logger.cc
index fc17070..c6fdb6e 100644
--- a/i/marvin/src/log/logger.cc
+++ b/i/marvin/src/log/logger.cc
@@ -25,6 +25,7 @@
#include "logger_null.hh"
#include "logger_stdout.hh"
+#include "logger_file.hh"
#include <stdexcept>
@@ -32,11 +33,15 @@
Logger *
Logger::create (const std::string &loggerName)
{
- // TODO Manages "file:my_file.txt"
if (loggerName == "null")
return new LoggerNull;
else if (loggerName == "stdout")
return new LoggerStdout;
+ else if (loggerName.substr (0, 4) == "file")
+ if (loggerName.size () < 6)
+ throw std::runtime_error ("Missing filename");
+ else
+ return new LoggerFile (loggerName.substr (5));
else
throw std::invalid_argument ("Unknown logger : " + loggerName);
return 0;