diff --git a/c11logtest/c11logtest/ReadMe.txt b/c11logtest/c11logtest/ReadMe.txt
new file mode 100644
index 00000000..233ecc2a
--- /dev/null
+++ b/c11logtest/c11logtest/ReadMe.txt
@@ -0,0 +1,40 @@
+========================================================================
+ CONSOLE APPLICATION : c11logtest Project Overview
+========================================================================
+
+AppWizard has created this c11logtest application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your c11logtest application.
+
+
+c11logtest.vcxproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+c11logtest.vcxproj.filters
+ This is the filters file for VC++ projects generated using an Application Wizard.
+ It contains information about the association between the files in your project
+ and the filters. This association is used in the IDE to show grouping of files with
+ similar extensions under a specific node (for e.g. ".cpp" files are associated with the
+ "Source Files" filter).
+
+c11logtest.cpp
+ This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named c11logtest.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/c11logtest/c11logtest/c11logtest.vcxproj b/c11logtest/c11logtest/c11logtest.vcxproj
new file mode 100644
index 00000000..811e7b19
--- /dev/null
+++ b/c11logtest/c11logtest/c11logtest.vcxproj
@@ -0,0 +1,112 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {DC7F2F3E-0D0E-4324-A278-410DBC4045AD}
+ Win32Proj
+ c11logtest
+
+
+
+ Application
+ true
+ v120
+ Unicode
+
+
+ Application
+ false
+ v120
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ ../../include
+
+
+ Console
+ true
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ ../../include
+ false
+ StreamingSIMDExtensions2
+
+
+ Console
+ true
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/c11logtest/c11logtest/c11logtest.vcxproj.filters b/c11logtest/c11logtest/c11logtest.vcxproj.filters
new file mode 100644
index 00000000..c0deacb9
--- /dev/null
+++ b/c11logtest/c11logtest/c11logtest.vcxproj.filters
@@ -0,0 +1,90 @@
+
+
+
+
+ {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
+
+
+ {bad4e9e3-82bd-4b02-9b4a-43198cc65844}
+
+
+ {a4cc3c0e-8713-4146-98c7-1e7ab4ed95f8}
+
+
+ {87170f3b-5292-49b8-8581-7db7cb9abd29}
+
+
+
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\c11log
+
+
+ Header Files\c11log
+
+
+ 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\details
+
+
+ Header Files\c11log\details
+
+
+ Header Files\c11log\details
+
+
+ Header Files\c11log\sinks
+
+
+ Header Files\c11log\sinks
+
+
+ Header Files\c11log\sinks
+
+
+ Header Files\c11log\sinks
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/c11logtest/c11logtest/stdafx.cpp b/c11logtest/c11logtest/stdafx.cpp
new file mode 100644
index 00000000..cb2b4191
--- /dev/null
+++ b/c11logtest/c11logtest/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// c11logtest.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/c11logtest/c11logtest/stdafx.h b/c11logtest/c11logtest/stdafx.h
new file mode 100644
index 00000000..b005a839
--- /dev/null
+++ b/c11logtest/c11logtest/stdafx.h
@@ -0,0 +1,15 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include
+#include
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/c11logtest/c11logtest/targetver.h b/c11logtest/c11logtest/targetver.h
new file mode 100644
index 00000000..87c0086d
--- /dev/null
+++ b/c11logtest/c11logtest/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include
diff --git a/example/example.cpp b/example/example.cpp
index db8a8752..85717f3d 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -15,8 +15,8 @@ using namespace c11log;
using namespace utils;
int main(int argc, char* argv[])
-{
- const unsigned int howmany = argc <= 1 ? 1000000:atoi(argv[1]);
+{
+ const unsigned int howmany = argc <= 1 ? 5000000:atoi(argv[1]);
logger cout_logger ("example", sinks::stdout_sink());
cout_logger.info() << "Hello logger";
@@ -37,9 +37,9 @@ int main(int argc, char* argv[])
auto delta = system_clock::now() - start;
auto delta_d = duration_cast> (delta).count();
- cout_logger.info("Total:") << format(howmany);
- cout_logger.info("Delta:") << format(delta_d);
- cout_logger.info("Rate:") << format(howmany/delta_d) << "/sec";
+ cout << "Total:" << format(howmany) << endl;
+ cout<< "Delta:" << format(delta_d) << endl;
+ cout << "Rate:" << format(howmany/delta_d) << "/sec" << endl;
return 0;
}
diff --git a/include/c11log/details/fast_oss.h b/include/c11log/details/fast_oss.h
index 56a7adae..dd204576 100644
--- a/include/c11log/details/fast_oss.h
+++ b/include/c11log/details/fast_oss.h
@@ -4,6 +4,7 @@
// uses stack_buf as the underlying buffer (upto 192 bytes before using the heap)
#include
+#include
#include "stack_buf.h"
namespace c11log
@@ -13,8 +14,8 @@ namespace details
class stack_devicebuf :public std::streambuf
{
-public:
- static constexpr unsigned short stack_size = 192;
+public:
+ static const unsigned short stack_size = 192;
using stackbuf_t = stack_buf;
stack_devicebuf() = default;
diff --git a/include/c11log/details/line_logger.h b/include/c11log/details/line_logger.h
index e3e51fc9..f0a53885 100644
--- a/include/c11log/details/line_logger.h
+++ b/include/c11log/details/line_logger.h
@@ -6,7 +6,6 @@
#include "fast_oss.h"
-
// line_logger class.
// aggregates single log line (on the stack if possibe) and calls the logger upon destruction
diff --git a/include/c11log/details/stack_buf.h b/include/c11log/details/stack_buf.h
index 719febd5..8ee5075d 100644
--- a/include/c11log/details/stack_buf.h
+++ b/include/c11log/details/stack_buf.h
@@ -17,7 +17,7 @@ class stack_buf
public:
using bufpair_t = std::pair;
using iterator = char const*;
- static constexpr unsigned short stack_size = STACK_SIZE;
+ static const unsigned short stack_size = STACK_SIZE;
stack_buf() :_v(), _stack_size(0) {}
~stack_buf() = default;
diff --git a/include/c11log/formatter.h b/include/c11log/formatter.h
index bcba08ea..955d7237 100644
--- a/include/c11log/formatter.h
+++ b/include/c11log/formatter.h
@@ -34,10 +34,12 @@ public:
{
details::fast_oss oss;
_format_time(msg.time, oss);
+
if(!msg.logger_name.empty())
oss << " [" << msg.logger_name << ':' << c11log::level::to_str(msg.level) << "] ";
else
oss << " [" << c11log::level::to_str(msg.level) << "] ";
+
oss << msg.raw << details::os::eol();
msg.formatted = oss.str();
}
diff --git a/include/c11log/logger.h b/include/c11log/logger.h
index 532d0944..d865e27d 100644
--- a/include/c11log/logger.h
+++ b/include/c11log/logger.h
@@ -31,7 +31,7 @@ public:
using sinks_vector_t = std::vector;
using sinks_init_list = std::initializer_list;
- using formatter_ptr = std::shared_ptr;
+ using formatter_ptr = std::unique_ptr;
logger(const std::string& name, sinks_init_list, formatter_ptr = nullptr);
logger(const std::string& name, sink_ptr, formatter_ptr = nullptr);
@@ -92,18 +92,19 @@ logger& get_logger(const std::string& name);
inline c11log::logger::logger(const std::string& name, sinks_init_list sinks_list, formatter_ptr f) :
_logger_name(name),
- _formatter(f),
+ _formatter(std::move(f)),
_sinks(sinks_list)
{
//Seems that vs2013 doesnt support std::atomic member initialization, so its done here
_min_level = level::INFO;
if(!_formatter)
- _formatter = std::make_shared();
+ _formatter = std::make_unique();
+
}
inline c11log::logger::logger(const std::string& name, sink_ptr sink, formatter_ptr f) :
- logger(name, {sink}, f) {}
+ logger(name, {sink}, std::move(f)) {}