From 9934ea40440efa73f9bb5fffeaca53461460dc63 Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 27 Jan 2014 11:44:10 +0200 Subject: [PATCH] delete --- Makefile | 30 ------- c11log.sln | 34 -------- c11log.v12.suo | Bin 36864 -> 0 bytes c11log.vcxproj | 115 --------------------------- c11log.vcxproj.filters | 102 ------------------------ include/c11log/details/line_logger.h | 7 +- include/c11log/logger.h | 2 + include/c11log/sinks/base_sink.h | 4 +- include/c11log/sinks/file_sinks.h | 9 ++- src/formatters.cpp | 6 +- src/os.cpp | 9 ++- 11 files changed, 22 insertions(+), 296 deletions(-) delete mode 100644 Makefile delete mode 100644 c11log.sln delete mode 100644 c11log.v12.suo delete mode 100644 c11log.vcxproj delete mode 100644 c11log.vcxproj.filters diff --git a/Makefile b/Makefile deleted file mode 100644 index 261715b9..00000000 --- a/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -CC = g++ -CCFLAGS = -std=c++11 -pthread -Iinclude -O3 -flto - -all: testlog - -testlog: test.o lib - $(CC) -o testlog test.o libc11log.a $(CCFLAGS) - -lib: factory.o formatters.o line_logger.o os.o - ar rvs libc11log.a $^; - - -test.o: src/test.cpp - $(CC) -c -o $@ $^ $(CCFLAGS) - -factory.o: src/factory.cpp - $(CC) -c -o $@ $^ $(CCFLAGS) - -formatters.o: src/formatters.cpp - $(CC) -c -o $@ $^ $(CCFLAGS) - -line_logger.o: src/line_logger.cpp - $(CC) -c -o $@ $^ $(CCFLAGS) - -os.o: src/os.cpp - $(CC) -c -o $@ $^ $(CCFLAGS) - -.PHONY: clean -clean: - rm -f *.o libc11log.a testlog diff --git a/c11log.sln b/c11log.sln deleted file mode 100644 index 12cf0eaf..00000000 --- a/c11log.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c11log", "c11log.vcxproj", "{BBFA8622-1945-4EB0-BAF4-473BE753ED24}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{429A1E1E-6F89-4941-B4A7-7464CEA22587}" - ProjectSection(ProjectDependencies) = postProject - {BBFA8622-1945-4EB0-BAF4-473BE753ED24} = {BBFA8622-1945-4EB0-BAF4-473BE753ED24} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BBFA8622-1945-4EB0-BAF4-473BE753ED24}.Debug|Win32.ActiveCfg = Debug|Win32 - {BBFA8622-1945-4EB0-BAF4-473BE753ED24}.Debug|Win32.Build.0 = Debug|Win32 - {BBFA8622-1945-4EB0-BAF4-473BE753ED24}.Release|Win32.ActiveCfg = Release|Win32 - {BBFA8622-1945-4EB0-BAF4-473BE753ED24}.Release|Win32.Build.0 = Release|Win32 - {429A1E1E-6F89-4941-B4A7-7464CEA22587}.Debug|Win32.ActiveCfg = Debug|Win32 - {429A1E1E-6F89-4941-B4A7-7464CEA22587}.Debug|Win32.Build.0 = Debug|Win32 - {429A1E1E-6F89-4941-B4A7-7464CEA22587}.Release|Win32.ActiveCfg = Release|Win32 - {429A1E1E-6F89-4941-B4A7-7464CEA22587}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection -EndGlobal diff --git a/c11log.v12.suo b/c11log.v12.suo deleted file mode 100644 index e9581de907b7f73a537e1011402486a341d8ce97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36864 zcmeHQdvF}ZnI9R91(=6151W9IjWLf{i*~h=EZYj!K4cqXERZcjydYMqk+jxID|T15 zg=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4MJZ=qC|`W*ac_It`DC zkfHTbD{cZrk;jw3Ag%&6(RwL}*jp3UX#A%D@;e4aJdN+Mk+{}rM~7o6Qs`BIDimF3 zOPh`dwnG-90>v~syqMWeWrmGnnpF<}@cOh5jw#BcYAyH=KYcic_ka`+DybTmRE@0i zzv4f}r?z5JIZ(r-V!^jd%Kt1<4X-Kntnptw+&(-a%_6FaGsS;C(%&D&x}fl83T4ax zTz|^|ZaYDoE^*)T3AJi*`r`KBQI`MF7#UQ%I3fc8w}utURZjm{pp@UUI6>!If((qw z#kv4$Y*c%Y{Y}k-ErV@?e*ZvAQ@lBD{9CRL8|+)LHcO-S^-QF@ zk|{kB&&Ao1rE6KXN3LVu`NT+HUkL5Qy6#HqsR0_~w9|0j!{X-tpUjNk)%8qfbNZ++ zoKB_mL=K(G`qt}XdM26hMUqBFJTrM)V8@63`_E7#^RKF%`2K6z-+$d97fMeqgQc~y zVKkdaXHv=j{ALJx-V1GQ@s>nOtG~TDs5h-@zh$MW+`I}m#IwV>cz+7pt(LfMISI>t zp4`Co;q>TuJfmmoiLEDjhmP;h)j#UADdgse-YzJFs^B*N4%LaHF+#WC^c8P - - - - Debug - Win32 - - - Release - Win32 - - - - {BBFA8622-1945-4EB0-BAF4-473BE753ED24} - Win32Proj - c11log - - - - StaticLibrary - true - v120 - Unicode - - - StaticLibrary - false - v120 - true - Unicode - - - - - - - - - - - - - $(ProjectDir)build\ - $(ProjectName)-debug - - - $(ProjectDir)build\ - $(ProjectName) - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir);$(ProjectDir)\include;%(AdditionalIncludeDirectories) - - - Windows - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir);$(ProjectDir)\include;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - \ No newline at end of file diff --git a/c11log.vcxproj.filters b/c11log.vcxproj.filters deleted file mode 100644 index 22e1df4f..00000000 --- a/c11log.vcxproj.filters +++ /dev/null @@ -1,102 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {3f3d8a51-d799-43e2-bd6e-3638f1cd4f54} - - - {d087c87d-8703-46a1-aa23-4509cf253e87} - - - {5af50a0f-d174-41cd-833c-ead8ba06199a} - - - {64fe6898-a191-4d60-9363-25ecfd196f30} - - - - - - - - Header Files - - - Header Files - - - Header Files\c11log - - - Header Files\c11log - - - Header Files\c11log\details - - - Header Files\c11log\formatters - - - Header Files\c11log\sinks - - - Header Files\c11log\sinks - - - Header Files\c11log\sinks - - - Header Files\c11log - - - Header Files\c11log\details - - - Header Files\c11log\details - - - Header Files\c11log\details - - - Header Files\c11log\details - - - Header Files\c11log\details - - - Header Files\c11log\sinks - - - Header Files\c11log\details - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/include/c11log/details/line_logger.h b/include/c11log/details/line_logger.h index 42c24a9b..e59b5684 100644 --- a/include/c11log/details/line_logger.h +++ b/include/c11log/details/line_logger.h @@ -9,8 +9,9 @@ namespace details { class line_logger { public: - c11log::details::line_logger::line_logger(logger* callback_logger, level::level_enum msg_level); - c11log::details::line_logger::line_logger(logger* callback_logger):_callback_logger(nullptr) {}; + line_logger(logger* callback_logger, level::level_enum msg_level); + line_logger(logger* callback_logger):_callback_logger(nullptr) {}; + line_logger(const line_logger&){}; ~line_logger(); template @@ -27,4 +28,4 @@ private: }; } //Namespace details -} // Namespace c11log \ No newline at end of file +} // Namespace c11log diff --git a/include/c11log/logger.h b/include/c11log/logger.h index 97f18b88..6b8f4b10 100644 --- a/include/c11log/logger.h +++ b/include/c11log/logger.h @@ -14,6 +14,8 @@ #include "details/factory.h" + + namespace c11log { class logger { diff --git a/include/c11log/sinks/base_sink.h b/include/c11log/sinks/base_sink.h index 21717a75..e46cfcd8 100644 --- a/include/c11log/sinks/base_sink.h +++ b/include/c11log/sinks/base_sink.h @@ -32,7 +32,7 @@ public: protected: virtual void sink_it_(const std::string& msg) = 0; - std::atomic _level = level::INFO; + std::atomic _level{level::INFO}; }; class null_sink:public base_sink { @@ -41,4 +41,4 @@ protected: {} }; } -} \ No newline at end of file +} diff --git a/include/c11log/sinks/file_sinks.h b/include/c11log/sinks/file_sinks.h index e17a07df..798c7c4a 100644 --- a/include/c11log/sinks/file_sinks.h +++ b/include/c11log/sinks/file_sinks.h @@ -150,9 +150,10 @@ private: static std::string _calc_filename(const std::string& basename, const std::string& extension) { std::ostringstream oss; - std::tm now_tm = c11log::details::os::localtime(); - oss << basename << std::put_time(&now_tm, ".%Y-%m-%d.") << extension; - return oss.str(); + std::tm tm = c11log::details::os::localtime(); + char buf[32]; + sprintf(buf, ".%Y-%m-%d.", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); + return buf; } std::string _base_filename; @@ -162,4 +163,4 @@ private: std::mutex mutex_; }; } -} \ No newline at end of file +} diff --git a/src/formatters.cpp b/src/formatters.cpp index ff384ac9..81900673 100644 --- a/src/formatters.cpp +++ b/src/formatters.cpp @@ -10,10 +10,10 @@ void c11log::formatters::format_time(const c11log::formatters::timepoint& tp, st int millis = static_cast(std::chrono::duration_cast(duration).count() % 1000); //std::put_time(&tm, "[ %Y-%m-%d %H:%M:%S ]") - seems too slow char buf[64]; - sprintf(buf, "[%d-%02d-%02d %02d:%02d:%02d.%03d]", + auto size = sprintf(buf, "[%d-%02d-%02d %02d:%02d:%02d.%03d]", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, millis); - dest << buf; + dest.write(buf, size); } void c11log::formatters::format_time(std::ostream& dest) @@ -33,4 +33,4 @@ std::string c11log::formatters::to_hex(const unsigned char* buf, std::size_t siz oss << _hex_chars[buf[i] & 0x0F]; } return oss.str(); -} \ No newline at end of file +} diff --git a/src/os.cpp b/src/os.cpp index 63956a9b..7fca8fc0 100644 --- a/src/os.cpp +++ b/src/os.cpp @@ -7,11 +7,14 @@ namespace details { namespace os { std::tm localtime(const std::time_t &time_t) { -#ifdef _MSC_VER + std::tm tm; +#ifdef _MSC_VER localtime_s(&tm, &time_t); - return tm; +#else + localtime_r(&time_t, &tm); #endif + return tm; } std::tm localtime() @@ -21,4 +24,4 @@ std::tm localtime() } } } -} \ No newline at end of file +}