Commits

Danny Gratzer committed e6cbd6e Draft

Added a demo and makefile

  • Participants
  • Parent commits 74629e5

Comments (0)

Files changed (3)

File examples/demo.cpp

+#include <string>
+#include "logger_creator.hpp"
+#include "logger.hpp"
+#include "handlers/cerr_handler.hpp"
+#include "handlers/file_handler.hpp"
+#include "handlers/memory_handler.hpp"
+#include "handlers/rolling_handler.hpp"
+#include <memory>
+using namespace al;
+
+logger foo(){
+
+  std_creator factory;
+  //factory.add_handler(std::make_shared<cerr_handler>());
+  //auto h = std::make_shared<file_handler>("log");
+  //factory.add_handler(h);
+  //factory.add_handler(std::make_shared<memory_handler>(10, h));
+  factory.add_handler(std::make_shared<rolling_handler>("logs", 3, 2));
+  return factory.spawn("test");
+}
+
+int main(){
+ 
+  auto log = foo();
+
+  for(int i = 0; i<25; ++i)
+    log<<std::to_string(i)<<endl;
+}
+PROJECT = library.a
+OBJECTS = logger.o rotator.o file_handler.o memory_handler.o
+CFLAGS  = -Wall -pedantic
+
+demo: ${OBJECTS} demo.o
+	g++ -std=c++0x demo.o ${OBJECTS} -o demo
+
+demo.o : examples/demo.cpp
+	g++ -std=c++0x -c $(CFLAGS) -Isrc examples/demo.cpp
+logger.o : src/logger.cpp
+	g++  -std=c++0x -c $(CFLAGS) -Isrc src/logger.cpp
+memory_handler.o : src/handlers/memory_handler.cpp
+	g++ -std=c++0x -c $(CFLAGS) -Isrc src/handlers/memory_handler.cpp
+file_handler.o : src/handlers/file_handler.cpp
+	g++ -std=c++0x -c $(CFLAGS) -Isrc src/handlers/file_handler.cpp
+rotator.o : src/handlers/file_manipulators/rotator.cpp
+	g++ -std=c++0x -c $(CFLAGS) -Isrc src/handlers/file_manipulators/rotator.cpp
+clean:
+	rm -rf *.o
+	rm demo
+clean-logs:
+	rm -rf logs*
+	rm -rf log

File src/levels.hpp

     info,
     warning,
     nonfatal_error,
-    fatal_error,
+    fatal_error
   };
 }