Browse Source

Ok, make docs, doxygen. Boost Logging!

Steve Thielemann 3 years ago
parent
commit
4fcd4e09e6
7 changed files with 492 additions and 46 deletions
  1. 5 0
      .gitignore
  2. 4 1
      CMakeLists.txt
  3. 377 0
      doxy.config
  4. 2 0
      make_docs.sh
  5. 57 26
      session.cpp
  6. 12 18
      session.h
  7. 35 1
      twproxy.cpp

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+*.yaml
+*.log
+.vscode
+build/
+docs/

+ 4 - 1
CMakeLists.txt

@@ -26,10 +26,13 @@ set(CMAKE_CXX_STANDARD   14)
 # set(CMAKE_CXX_STANDARD   17)
 set(CMAKE_CXX_EXTENSIONS ON)
 
+ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
 
-FIND_PACKAGE( Boost 1.60 COMPONENTS program_options REQUIRED )
+# add log_setup log 
+FIND_PACKAGE( Boost 1.60 COMPONENTS program_options log_setup log REQUIRED )
 INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
 
+
 ADD_EXECUTABLE( twproxy twproxy.cpp config.cpp session.cpp session.h )
 TARGET_LINK_LIBRARIES( twproxy ${Boost_LIBRARIES} pthread )
 

+ 377 - 0
doxy.config

@@ -0,0 +1,377 @@
+# Doxyfile 1.8.13
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = "TradeWars Proxy C++"
+PROJECT_NUMBER         =
+PROJECT_BRIEF          =
+PROJECT_LOGO           =
+OUTPUT_DIRECTORY       = docs
+CREATE_SUBDIRS         = NO
+ALLOW_UNICODE_NAMES    = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        =
+STRIP_FROM_INC_PATH    =
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+QT_AUTOBRIEF           = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 4
+ALIASES                =
+TCL_SUBST              =
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+OPTIMIZE_FOR_FORTRAN   = NO
+OPTIMIZE_OUTPUT_VHDL   = NO
+EXTENSION_MAPPING      =
+MARKDOWN_SUPPORT       = YES
+TOC_INCLUDE_HEADINGS   = 0
+AUTOLINK_SUPPORT       = YES
+BUILTIN_STL_SUPPORT    = YES
+CPP_CLI_SUPPORT        = NO
+SIP_SUPPORT            = NO
+IDL_PROPERTY_SUPPORT   = YES
+DISTRIBUTE_GROUP_DOC   = NO
+GROUP_NESTED_COMPOUNDS = NO
+SUBGROUPING            = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS  = NO
+TYPEDEF_HIDES_STRUCT   = NO
+LOOKUP_CACHE_SIZE      = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+# EXTRACT_ALL            = NO
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+# NO
+EXTRACT_PACKAGE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+EXTRACT_ANON_NSPACES   = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+# NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_INCLUDE_FILES     = YES
+SHOW_GROUPED_MEMB_INC  = NO
+FORCE_LOCAL_INCLUDES   = NO
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES       = NO
+SORT_BY_SCOPE_NAME     = NO
+STRICT_PROTO_MATCHING  = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       =
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_FILES             = YES
+SHOW_NAMESPACES        = YES
+FILE_VERSION_FILTER    =
+LAYOUT_FILE            =
+CITE_BIB_FILES         =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_AS_ERROR          = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           =
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = . ./door++
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.idl \
+                         *.ddl \
+                         *.odl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.cs \
+                         *.d \
+                         *.php \
+                         *.php4 \
+                         *.php5 \
+                         *.phtml \
+                         *.inc \
+                         *.m \
+                         *.markdown \
+                         *.md \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.pyw \
+                         *.f90 \
+                         *.f95 \
+                         *.f03 \
+                         *.f08 \
+                         *.f \
+                         *.for \
+                         *.tcl \
+                         *.vhd \
+                         *.vhdl \
+                         *.ucf \
+                         *.qsf
+RECURSIVE              = NO
+EXCLUDE                =
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       =
+EXCLUDE_SYMBOLS        =
+EXAMPLE_PATH           = ./examples
+EXAMPLE_PATTERNS       = *
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             =
+INPUT_FILTER           =
+FILTER_PATTERNS        =
+FILTER_SOURCE_FILES    = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE = README.md
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION    = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS        = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS          =
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = YES
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            =
+HTML_FOOTER            =
+HTML_STYLESHEET        =
+HTML_EXTRA_STYLESHEET  =
+HTML_EXTRA_FILES       =
+HTML_COLORSTYLE_HUE    = 220
+HTML_COLORSTYLE_SAT    = 100
+HTML_COLORSTYLE_GAMMA  = 80
+HTML_TIMESTAMP         = NO
+HTML_DYNAMIC_SECTIONS  = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET        = NO
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME  = Publisher
+GENERATE_HTMLHELP      = NO
+CHM_FILE               =
+HHC_LOCATION           =
+GENERATE_CHI           = NO
+CHM_INDEX_ENCODING     =
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+GENERATE_QHP           = NO
+QCH_FILE               =
+QHP_NAMESPACE          = org.doxygen.Project
+QHP_VIRTUAL_FOLDER     = doc
+QHP_CUST_FILTER_NAME   =
+QHP_CUST_FILTER_ATTRS  =
+QHP_SECT_FILTER_ATTRS  =
+QHG_LOCATION           =
+GENERATE_ECLIPSEHELP   = NO
+ECLIPSE_DOC_ID         = org.doxygen.Project
+DISABLE_INDEX          = NO
+GENERATE_TREEVIEW      = NO
+ENUM_VALUES_PER_LINE   = 4
+TREEVIEW_WIDTH         = 250
+EXT_LINKS_IN_WINDOW    = NO
+FORMULA_FONTSIZE       = 10
+FORMULA_TRANSPARENT    = YES
+USE_MATHJAX            = NO
+MATHJAX_FORMAT         = HTML-CSS
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS     =
+MATHJAX_CODEFILE       =
+SEARCHENGINE           = YES
+SERVER_BASED_SEARCH    = NO
+EXTERNAL_SEARCH        = NO
+SEARCHENGINE_URL       =
+SEARCHDATA_FILE        = searchdata.xml
+EXTERNAL_SEARCH_ID     =
+EXTRA_SEARCH_MAPPINGS  =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = YES
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4
+EXTRA_PACKAGES         =
+LATEX_HEADER           =
+LATEX_FOOTER           =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES      =
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+LATEX_SOURCE_CODE      = NO
+LATEX_BIB_STYLE        = plain
+LATEX_TIMESTAMP        = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    =
+RTF_EXTENSIONS_FILE    =
+RTF_SOURCE_CODE        = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_SUBDIR             =
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK       = NO
+DOCBOOK_OUTPUT         = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  =
+PREDEFINED             =
+EXPAND_AS_DEFINED      =
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES               =
+GENERATE_TAGFILE       =
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+EXTERNAL_PAGES         = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+MSCGEN_PATH            =
+DIA_PATH               =
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+DOT_NUM_THREADS        = 0
+DOT_FONTNAME           = Helvetica
+DOT_FONTSIZE           = 10
+DOT_FONTPATH           =
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+UML_LIMIT_NUM_FIELDS   = 10
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+CALLER_GRAPH           = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+INTERACTIVE_SVG        = NO
+DOT_PATH               =
+DOTFILE_DIRS           =
+MSCFILE_DIRS           =
+DIAFILE_DIRS           =
+PLANTUML_JAR_PATH      =
+PLANTUML_CFG_FILE      =
+PLANTUML_INCLUDE_PATH  =
+DOT_GRAPH_MAX_NODES    = 50
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES

+ 2 - 0
make_docs.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+doxygen doxy.config 2>&1

+ 57 - 26
session.cpp

@@ -40,16 +40,16 @@ void session::on_connect(const boost::system::error_code error) {
   // We've connected to the server!  WOOT WOOT!
   if (!error) {
     std::cout << "Connected to server!" << std::endl;
-    do_write("Connected...\n\r");
+    to_client("Connected...\n\r");
     connected = true;
     if (rlogin_auth[0] != 0) {
       // Ok, the rlogin information was junk --
-      do_write("Let me make up some fake rlogin data for you...\n\r");
+      to_client("Let me make up some fake rlogin data for you...\n\r");
       char temp[] = "\0test\0test\0terminal/9600\0";
       std::string tmp(temp, sizeof(temp));
-      server_write(tmp);
+      to_server(tmp);
     } else {
-      server_write(rlogin_auth);
+      to_server(rlogin_auth);
     }
 
     server_read();
@@ -60,7 +60,7 @@ void session::on_connect(const boost::system::error_code error) {
     output += " : ";
     output += port;
     output += "\n\r";
-    do_write(output);
+    to_client(output);
 
     std::cout << "Failed to connect to server." << std::endl;
     std::cout << "SHUTDOWN..." << std::endl;
@@ -80,7 +80,7 @@ void session::process_lines(void) {
   while ((pos = server_prompt.find("\n\r")) != std::string::npos) {
     // line
     std::string line = server_prompt.substr(0, pos + 2);
-    server_prompt = server_prompt.substr(pos + 2); 
+    server_prompt = server_prompt.substr(pos + 2);
 
     // Remove \n\r for dispatching
     std::string part = line.substr(0, pos);
@@ -89,19 +89,23 @@ void session::process_lines(void) {
       server_sent = 0;
     };
     // display on?
-    do_write(line);
+    to_client(line);
 
     dispatch_line(part);
   }
 
   // display on?
   if (server_sent != 0) {
-      std::string part = server_prompt.substr(server_sent);
-      do_write(part);
-      server_sent = server_prompt.size();
+    // send partial
+    std::string part = server_prompt.substr(server_sent);
+    to_client(part);
+    server_sent = server_prompt.size();
   } else {
-      do_write(server_prompt);
+    // send all
+    if (!server_prompt.empty()) {
+      to_client(server_prompt);
       server_sent = server_prompt.size();
+    }
   }
 
   // server_sent is the # of chars we've already sent of this.
@@ -119,13 +123,13 @@ void session::server_read(void) {
           server_prompt.append(server_buffer, length);
           process_lines();
 
-        /*
-          if (length) {
-            // std::cout << length << std::endl;
-            std::cout << "S: " << server_buffer << std::endl;
-            do_write(server_buffer);
-          }
-          */
+          /*
+            if (length) {
+              // std::cout << length << std::endl;
+              std::cout << "S: " << server_buffer << std::endl;
+              do_write(server_buffer);
+            }
+            */
 
           server_read();
         } else {
@@ -156,7 +160,7 @@ void session::on_resolve(
     std::string output = "Unable to resolve: ";
     output += host;
     output += "\n\r";
-    do_write(output);
+    to_client(output);
     std::cout << "Unable to resolve?" << std::endl;
     std::cout << "SHUTDOWN ..." << std::endl;
     socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both);
@@ -178,11 +182,11 @@ void session::do_read(void) {
 
             // parse authentication information
             parse_auth();
-            do_write(std::string(1, 0));
+            to_client(std::string(1, 0));
 
-            do_write("Welcome, ");
-            do_write(rlogin_name);
-            do_write("\n\r");
+            to_client("Welcome, ");
+            to_client(rlogin_name);
+            to_client("\n\r");
 
             // Activate the connection to the server
 
@@ -200,7 +204,7 @@ void session::do_read(void) {
 
           } else if (length) {
             // std::cout << length << std::endl;
-            server_write(read_buffer);
+            to_server(read_buffer);
             std::cout << "C: " << read_buffer << std::endl;
             // do_write(output);
           }
@@ -215,7 +219,7 @@ void session::do_read(void) {
       });
 }
 
-void session::do_write(std::string message) {
+void session::to_client(std::string message) {
   auto self(shared_from_this());
   boost::asio::async_write(
       socket_, boost::asio::buffer(message),
@@ -231,7 +235,7 @@ void session::do_write(std::string message) {
       });
 }
 
-void session::server_write(std::string message) {
+void session::to_server(std::string message) {
   auto self(shared_from_this());
   boost::asio::async_write(
       server_, boost::asio::buffer(message),
@@ -250,3 +254,30 @@ void session::server_write(std::string message) {
 void session::on_shutdown(boost::system::error_code ec) {
   std::cout << "shutdown." << std::endl;
 }
+
+server::server(boost::asio::io_service &io_service,
+               const boost::asio::ip::tcp::endpoint &endpoint, std::string host,
+               std::string port)
+    : io_service_{io_service}, acceptor_{io_service_, endpoint}, host_{host},
+      port_{port} {
+  do_accept();
+}
+
+/**
+ * setup async connect accept
+ *
+ * This creates a session for each connection.  Using make_shared allows the
+ * session to automatically clean up when it is no longer active/has anything
+ * running in the reactor.
+ */
+void server::do_accept(void) {
+  acceptor_.async_accept([this](boost::system::error_code ec,
+                                boost::asio::ip::tcp::socket socket) {
+    if (!ec) {
+      std::make_shared<session>(std::move(socket), io_service_, host_, port_)
+          ->start();
+    }
+
+    do_accept();
+  });
+}

+ 12 - 18
session.h

@@ -21,8 +21,8 @@ public:
   void on_resolve(const boost::system::error_code error,
                   const boost::asio::ip::tcp::resolver::results_type results);
   void do_read(void);
-  void do_write(std::string message);
-  void server_write(std::string message);
+  void to_client(std::string message);
+  void to_server(std::string message);
   void on_shutdown(boost::system::error_code ec);
 
   void dispatch_line(std::string line);
@@ -62,27 +62,21 @@ class server {
 public:
   server(boost::asio::io_service &io_service,
          const boost::asio::ip::tcp::endpoint &endpoint, std::string host,
-         std::string port)
-      : io_service_{io_service}, acceptor_{io_service_, endpoint}, host_{host},
-        port_{port} {
-    do_accept();
-  }
+         std::string port);
 
 private:
-  void do_accept() {
-    acceptor_.async_accept([this](boost::system::error_code ec,
-                                  boost::asio::ip::tcp::socket socket) {
-      if (!ec) {
-        std::make_shared<session>(std::move(socket), io_service_, host_, port_)
-            ->start();
-      }
-
-      do_accept();
-    });
-  }
+  void do_accept(void);
+
   boost::asio::io_service &io_service_;
   boost::asio::ip::tcp::acceptor acceptor_;
+  /**
+   * The host to connect to (from config)
+   */
   std::string host_;
+  /**
+   * The port to connect to (from config)
+   * 
+   */
   std::string port_;
 };
 

+ 35 - 1
twproxy.cpp

@@ -9,14 +9,44 @@
 //
 
 #include <boost/asio.hpp>
+#include <boost/log/attributes.hpp>
+#include <boost/log/utility/setup/common_attributes.hpp>
+#include <boost/log/core.hpp>
+// #include <boost/log/sinks/text_file_backend.hpp>
+#include <boost/log/trivial.hpp>
+#include <boost/log/utility/setup/file.hpp>
 #include <cstdlib>
+#include <fstream>
 #include <iostream>
-#include <string>
 #include <map>
+#include <string>
 
 #include "config.h"
 #include "session.h"
 
+void init_logging(void) {
+  /*
+    std::ifstream file("log_settings.ini");
+    if (!file.is_open()) {
+      std::cerr << "Could not open log_settings.ini file." << std::endl;
+      exit(1);
+    }
+
+    boost::log::init_from_stream(file);
+    */
+  // boost::log::add_file_log("proxy.log"); // WAT?
+  // boost::shared_ptr< boost::log::core > core = boost::log::core::get();
+  // core->add_global_attribute("TimeStamp", boost::attrs::local_clock());
+  boost::log::add_common_attributes();
+
+  boost::log::add_file_log(
+    boost::log::keywords::file_name = "proxy.log",
+    boost::log::keywords::format = "[%TimeStamp%]: %Message%"
+  );
+  boost::log::core::get()->set_filter(boost::log::trivial::severity >=
+                                      boost::log::trivial::info);
+}
+
 int main(int argc, char *argv[]) {
   // boost::json::json_value config;
 
@@ -25,6 +55,8 @@ int main(int argc, char *argv[]) {
     return EXIT_FAILURE;
   }
 
+  init_logging();
+
   std::map<std::string, std::string> config = yaml_parse(argv[1]);
 
   /*
@@ -46,7 +78,9 @@ int main(int argc, char *argv[]) {
     if (pos == config.end()) {
       config_ok = false;
       std::cout << "Config file missing: " << key << std::endl;
+      BOOST_LOG_TRIVIAL(fatal) << "Config file missing: " << key;
     }
+    BOOST_LOG_TRIVIAL(info) << "Config: " << key << " : " << config[key];
   }
   if (!config_ok)
     return 2;