mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-24 09:31:34 +08:00
delete
This commit is contained in:
parent
fa6f8b3c9a
commit
9934ea4044
30
Makefile
30
Makefile
@ -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
|
34
c11log.sln
34
c11log.sln
@ -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
|
BIN
c11log.v12.suo
BIN
c11log.v12.suo
Binary file not shown.
115
c11log.vcxproj
115
c11log.vcxproj
@ -1,115 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BBFA8622-1945-4EB0-BAF4-473BE753ED24}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>c11log</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)build\</OutDir>
|
||||
<TargetName>$(ProjectName)-debug</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)build\</OutDir>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\c11log\details\blocking_queue.h" />
|
||||
<ClInclude Include="include\c11log\details\factory.h" />
|
||||
<ClInclude Include="include\c11log\details\line_logger.h" />
|
||||
<ClInclude Include="include\c11log\details\message.h" />
|
||||
<ClInclude Include="include\c11log\details\null_mutex.h" />
|
||||
<ClInclude Include="include\c11log\details\os.h" />
|
||||
<ClInclude Include="include\c11log\details\fast_oss.h" />
|
||||
<ClInclude Include="include\c11log\formatters\formatters.h" />
|
||||
<ClInclude Include="include\c11log\level.h" />
|
||||
<ClInclude Include="include\c11log\logger.h" />
|
||||
<ClInclude Include="include\c11log\log_exception.h" />
|
||||
<ClInclude Include="include\c11log\sinks\async_sink.h" />
|
||||
<ClInclude Include="include\c11log\sinks\base_sink.h" />
|
||||
<ClInclude Include="include\c11log\sinks\file_sinks.h" />
|
||||
<ClInclude Include="include\c11log\sinks\stdout_sinks.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\factory.cpp" />
|
||||
<ClCompile Include="src\formatters.cpp" />
|
||||
<ClCompile Include="src\line_logger.cpp" />
|
||||
<ClCompile Include="src\os.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,102 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\c11log">
|
||||
<UniqueIdentifier>{3f3d8a51-d799-43e2-bd6e-3638f1cd4f54}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\c11log\sinks">
|
||||
<UniqueIdentifier>{d087c87d-8703-46a1-aa23-4509cf253e87}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\c11log\details">
|
||||
<UniqueIdentifier>{5af50a0f-d174-41cd-833c-ead8ba06199a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\c11log\formatters">
|
||||
<UniqueIdentifier>{64fe6898-a191-4d60-9363-25ecfd196f30}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\level.h">
|
||||
<Filter>Header Files\c11log</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\logger.h">
|
||||
<Filter>Header Files\c11log</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\line_logger.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\formatters\formatters.h">
|
||||
<Filter>Header Files\c11log\formatters</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\sinks\base_sink.h">
|
||||
<Filter>Header Files\c11log\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\sinks\stdout_sinks.h">
|
||||
<Filter>Header Files\c11log\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\sinks\file_sinks.h">
|
||||
<Filter>Header Files\c11log\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\log_exception.h">
|
||||
<Filter>Header Files\c11log</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\os.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\factory.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\null_mutex.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\fast_oss.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\message.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\sinks\async_sink.h">
|
||||
<Filter>Header Files\c11log\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\c11log\details\blocking_queue.h">
|
||||
<Filter>Header Files\c11log\details</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\factory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\formatters.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\os.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\line_logger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -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<typename T>
|
||||
@ -27,4 +28,4 @@ private:
|
||||
|
||||
};
|
||||
} //Namespace details
|
||||
} // Namespace c11log
|
||||
} // Namespace c11log
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "details/factory.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace c11log {
|
||||
|
||||
class logger {
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void sink_it_(const std::string& msg) = 0;
|
||||
std::atomic<int> _level = level::INFO;
|
||||
std::atomic<int> _level{level::INFO};
|
||||
};
|
||||
|
||||
class null_sink:public base_sink {
|
||||
@ -41,4 +41,4 @@ protected:
|
||||
{}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ void c11log::formatters::format_time(const c11log::formatters::timepoint& tp, st
|
||||
int millis = static_cast<int>(std::chrono::duration_cast<std::chrono::milliseconds>(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();
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user