added loggin methods

This commit is contained in:
max mustermann 2019-05-05 16:35:38 +02:00
parent aea2cacc47
commit 0e204bf2c1
6 changed files with 225 additions and 107 deletions

218
.idea/workspace.xml generated
View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="BookmarkManager">
<bookmark url="file://$PROJECT_DIR$/src/Logger.cpp" line="41" mnemonic="2" />
</component>
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true"> <component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
<generated> <generated>
<config projectName="iprefresher" targetName="iprefresher" /> <config projectName="iprefresher" targetName="iprefresher" />
@ -11,62 +14,13 @@
</configurations> </configurations>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="59c80f39-2468-4db0-9afd-14b8acdbffed" name="Default Changelist" comment="edited api class and made it to work"> <list default="true" id="59c80f39-2468-4db0-9afd-14b8acdbffed" name="Default Changelist" comment="deleted cmake files">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/Logger.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Logger.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CMakeCCompiler.cmake" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CMakeCXXCompiler.cmake" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/src/API.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/API.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CMakeDetermineCompilerABI_C.bin" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/src/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CMakeDetermineCompilerABI_CXX.bin" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CMakeSystem.cmake" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CompilerIdC/CMakeCCompilerId.c" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CompilerIdC/a.out" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CompilerIdCXX/CMakeCXXCompilerId.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/3.14.2/CompilerIdCXX/a.out" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/CMakeDirectoryInformation.cmake" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/CMakeOutput.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/Makefile.cmake" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/Makefile2" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/TargetDirectories.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/clion-environment.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/cmake.check_cache" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/feature_tests.bin" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/feature_tests.c" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/feature_tests.cxx" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/API.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/CXX.includecache" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/DependInfo.cmake" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/build.make" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/cmake_clean.cmake" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/depend.internal" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/depend.make" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/flags.make" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/link.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/main.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/iprefresher.dir/progress.make" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeFiles/progress.marks" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeDirectoryInformation.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeDirectoryInformation.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeOutput.log" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeOutput.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile2" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Makefile2" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Progress/3" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/Progress/count.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/TargetDirectories.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-log.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-log.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/API.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/CXX.includecache" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/CXX.includecache" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/DependInfo.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/DependInfo.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/build.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/build.make" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/cmake_clean.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/cmake_clean.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/depend.internal" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/depend.internal" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/depend.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/depend.make" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/flags.make" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/flags.make" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/link.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/link.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/iprefresher.dir/main.cpp.o" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/Makefile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/cmake_install.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/iprefresher.cbp" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/iprefresher.cbp" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/cmake-build-debug/" /> <ignored path="$PROJECT_DIR$/cmake-build-debug/" />
<ignored path="$PROJECT_DIR$/CMakeFiles/" /> <ignored path="$PROJECT_DIR$/CMakeFiles/" />
@ -82,15 +36,6 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" /> <component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" column="19" selection-start-line="9" selection-start-column="19" selection-end-line="9" selection-end-column="19" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/API.h"> <entry file="file://$PROJECT_DIR$/src/API.h">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -106,8 +51,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/API.cpp"> <entry file="file://$PROJECT_DIR$/src/API.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="101"> <state relative-caret-position="281">
<caret line="32" column="5" selection-start-line="32" selection-start-column="5" selection-end-line="32" selection-end-column="5" /> <caret line="44" column="17" selection-start-line="44" selection-start-column="17" selection-end-line="44" selection-end-column="17" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -117,11 +62,11 @@
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main.cpp"> <entry file="file://$PROJECT_DIR$/src/main.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165"> <state relative-caret-position="289">
<caret line="11" selection-start-line="11" selection-end-line="11" /> <caret line="29" column="41" lean-forward="true" selection-start-line="29" selection-start-column="41" selection-end-line="29" selection-end-column="41" />
<folding> <folding>
<element signature="e#0#19#0" expanded="true" /> <element signature="e#0#19#0" expanded="true" />
</folding> </folding>
@ -129,11 +74,47 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Logger.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="555">
<caret line="37" column="38" lean-forward="true" selection-start-line="37" selection-start-column="38" selection-end-line="37" selection-end-column="38" />
<folding>
<element signature="e#40#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cmake-build-debug/ip.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cmake-build-debug/dynurefresher.log">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Logger.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="38" selection-start-line="10" selection-start-column="22" selection-end-line="10" selection-end-column="38" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.gitignore"> <entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="290"> <state relative-caret-position="424">
<caret line="46" lean-forward="true" selection-start-line="46" selection-end-line="46" /> <caret line="38" column="23" selection-start-line="38" selection-start-column="23" selection-end-line="38" selection-end-column="23" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -150,9 +131,11 @@
<option value="$PROJECT_DIR$/main.cpp" /> <option value="$PROJECT_DIR$/main.cpp" />
<option value="$PROJECT_DIR$/API.cpp" /> <option value="$PROJECT_DIR$/API.cpp" />
<option value="$PROJECT_DIR$/CMakeLists.txt" /> <option value="$PROJECT_DIR$/CMakeLists.txt" />
<option value="$PROJECT_DIR$/src/API.cpp" />
<option value="$PROJECT_DIR$/src/main.cpp" />
<option value="$PROJECT_DIR$/.gitignore" /> <option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/src/API.cpp" />
<option value="$PROJECT_DIR$/src/Logger.h" />
<option value="$PROJECT_DIR$/src/main.cpp" />
<option value="$PROJECT_DIR$/src/Logger.cpp" />
</list> </list>
</option> </option>
</component> </component>
@ -174,6 +157,11 @@
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" /> <item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
<item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" /> <item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path>
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
<item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" />
<item name="cmake-build-debug" type="462c0819:PsiDirectoryNode" />
</path>
<path> <path>
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" /> <item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
<item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" /> <item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" />
@ -234,7 +222,7 @@
<workItem from="1556646880233" duration="656000" /> <workItem from="1556646880233" duration="656000" />
<workItem from="1556710548728" duration="6200000" /> <workItem from="1556710548728" duration="6200000" />
<workItem from="1557047487321" duration="761000" /> <workItem from="1557047487321" duration="761000" />
<workItem from="1557061811880" duration="2020000" /> <workItem from="1557061811880" duration="5098000" />
</task> </task>
<task id="LOCAL-00001" summary="edited api class and made it to work"> <task id="LOCAL-00001" summary="edited api class and made it to work">
<created>1557063528491</created> <created>1557063528491</created>
@ -243,11 +231,25 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1557063528491</updated> <updated>1557063528491</updated>
</task> </task>
<option name="localTasksCounter" value="2" /> <task id="LOCAL-00002" summary="edited api class and made it to work">
<created>1557063846200</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1557063846200</updated>
</task>
<task id="LOCAL-00003" summary="deleted cmake files">
<created>1557063931807</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1557063931807</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="14871000" /> <option name="totallyTimeSpent" value="17949000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="1919" y="0" width="1922" height="1081" extended-state="6" /> <frame x="1919" y="0" width="1922" height="1081" extended-state="6" />
@ -258,13 +260,13 @@
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.31875" /> <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.31875" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" /> <window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Database Changes" order="7" /> <window_info anchor="bottom" id="Database Changes" order="7" />
<window_info active="true" anchor="bottom" id="Messages" order="8" visible="true" weight="0.32708332" /> <window_info anchor="bottom" id="Messages" order="8" weight="0.32708332" />
<window_info anchor="bottom" id="Terminal" order="9" /> <window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" /> <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="11" /> <window_info anchor="bottom" id="Version Control" order="11" />
@ -280,7 +282,8 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="edited api class and made it to work" /> <MESSAGE value="edited api class and made it to work" />
<option name="LAST_COMMIT_MESSAGE" value="edited api class and made it to work" /> <MESSAGE value="deleted cmake files" />
<option name="LAST_COMMIT_MESSAGE" value="deleted cmake files" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test.cpp" /> <entry file="file://$PROJECT_DIR$/test.cpp" />
@ -307,29 +310,62 @@
<entry file="file://$PROJECT_DIR$/src/Hashmap.h"> <entry file="file://$PROJECT_DIR$/src/Hashmap.h">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="424">
<caret line="38" column="23" selection-start-line="38" selection-start-column="23" selection-end-line="38" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/API.cpp"> <entry file="file://$PROJECT_DIR$/src/API.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="101"> <state relative-caret-position="281">
<caret line="32" column="5" selection-start-line="32" selection-start-column="5" selection-end-line="32" selection-end-column="5" /> <caret line="44" column="17" selection-start-line="44" selection-start-column="17" selection-end-line="44" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/out.myfile">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="6" selection-start-line="1" selection-start-column="6" selection-end-line="1" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Logger.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="38" selection-start-line="10" selection-start-column="22" selection-end-line="10" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/ip.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/dynurefresher.log">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/Logger.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="555">
<caret line="37" column="38" lean-forward="true" selection-start-line="37" selection-start-column="38" selection-end-line="37" selection-end-column="38" />
<folding>
<element signature="e#40#58#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/main.cpp"> <entry file="file://$PROJECT_DIR$/src/main.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165"> <state relative-caret-position="289">
<caret line="11" selection-start-line="11" selection-end-line="11" /> <caret line="29" column="41" lean-forward="true" selection-start-line="29" selection-start-column="41" selection-end-line="29" selection-end-column="41" />
<folding> <folding>
<element signature="e#0#19#0" expanded="true" /> <element signature="e#0#19#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="290">
<caret line="46" lean-forward="true" selection-start-line="46" selection-end-line="46" />
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View File

@ -7,7 +7,7 @@ find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR}) include_directories(${CURL_INCLUDE_DIR})
set(SOURCE src/main.cpp src/API.h src/API.cpp src/Hashmap.h) set(SOURCE src/main.cpp src/API.h src/API.cpp src/Hashmap.h src/Logger.cpp src/Logger.h)
add_executable(iprefresher ${SOURCE}) add_executable(iprefresher ${SOURCE})

View File

@ -43,7 +43,6 @@ std::string API::request(std::string myurl, bool post, Hashmap<std::string,std::
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
if(post){ if(post){
std::cout << "add post data\n";
std::stringstream poststring; std::stringstream poststring;
poststring << "{"; poststring << "{";
for (int i = 0; i < map.size(); i++) { for (int i = 0; i < map.size(); i++) {
@ -54,7 +53,7 @@ std::string API::request(std::string myurl, bool post, Hashmap<std::string,std::
} }
poststring << "}"; poststring << "}";
std::cout << "post string: " << poststring.str() << "\n"; // std::cout << "post string: " << poststring.str() << "\n";
curl_easy_setopt(curl, CURLOPT_POST, 1); curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, poststring.str().c_str()); curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, poststring.str().c_str());
}else{ }else{

49
src/Logger.cpp Normal file
View File

@ -0,0 +1,49 @@
//
// Created by lukas on 05.05.19.
//
#include <fstream>
#include <ctime>
#include <iostream>
#include <sstream>
#include "Logger.h"
void Logger::safeip(std::string ip) {
std::ofstream out;
out.open("ip.txt",std::ios::out);
out << ip;
out.close();
}
std::string Logger::readip() {
std::ifstream in;
in.open("ip.txt",std::ios::in);
std::string ip;
in >> ip;
return ip;
}
void Logger::logToLogfile(std::string text) {
std::ofstream out;
out.open("dynurefresher.log",std::ios::out | std::ios::app);
std::time_t t = std::time(0); // get time now
std::tm* now = std::localtime(&t);
std::stringstream logline;
logline << "[ "<< (now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' << now->tm_mday
<< "_" << now->tm_hour << ":" << now->tm_min << ":" << now->tm_sec << " ] " << '\t' << text << std::endl;
out << logline.str();
out.close();
}

18
src/Logger.h Normal file
View File

@ -0,0 +1,18 @@
//
// Created by lukas on 05.05.19.
//
#ifndef IPREFRESHER_LOGGER_H
#define IPREFRESHER_LOGGER_H
class Logger {
public:
void logToLogfile(std::string text);
void safeip(std::string ip);
std::string readip();
};
#endif //IPREFRESHER_LOGGER_H

View File

@ -1,12 +1,24 @@
#include <iostream> #include <iostream>
#include <ctime>
#include "API.h" #include "API.h"
#include "Logger.h"
int main() { int main() {
std::cout << "Hello, World!" << std::endl;
API api; API api;
Logger logger;
std::string ip = api.request("https://api.ipify.org"); std::string ip = api.request("https://api.ipify.org");
std::cout << ip <<std::endl; std::cout << "ip is: " << ip <<std::endl;
std::string oldip = logger.readip();
if(oldip == ip){
std::cout << "no change -- ip: " << ip << std::endl;
logger.logToLogfile("no change -- ip: "+ip);
} else{
logger.logToLogfile("ip changed! -- from :" + oldip + "to: "+ip);
std::cout << "ip changed! -- from :" << oldip << "to: " << ip << std::endl;
//api key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg //api key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg
@ -22,7 +34,11 @@ int main() {
std::string dynurepl = api.request("https://api.dynu.com/v2/dns/8506047",true, args,headers); std::string dynurepl = api.request("https://api.dynu.com/v2/dns/8506047",true, args,headers);
std::cout << "---" << dynurepl << "\n"; std::cout << "---" << dynurepl << std::endl;
logger.safeip(ip);
}
return 0; return 0;