forked from gabime/spdlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gabime:v1.x' into v1.x
- Loading branch information
Showing
15 changed files
with
311 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
Header only version: | ||
Header Only Version | ||
================================================================== | ||
Just copy the files to your build tree and use a C++11 compiler. | ||
Just copy the files to your build tree and use a C++11 compiler. | ||
Or use CMake: | ||
``` | ||
add_executable(example_header_only example.cpp) | ||
target_link_libraries(example_header_only spdlog::spdlog_header_only) | ||
``` | ||
|
||
|
||
Compiled library version: | ||
Compiled Library Version | ||
================================================================== | ||
CMake: | ||
``` | ||
add_executable(example example.cpp) | ||
target_link_libraries(example spdlog::spdlog) | ||
``` | ||
|
||
Or copy files src/*.cpp to your build tree and pass the -DSPDLOG_COMPILED_LIB to the compiler. | ||
|
||
Tested on: | ||
Important Information for Compilation: | ||
================================================================== | ||
* If you encounter compilation errors with gcc 4.8.x, please note that gcc 4.8.x does not fully support C++11. In such cases, consider upgrading your compiler or using a different version that fully supports C++11 standards | ||
|
||
Tested on: | ||
gcc 4.8.1 and above | ||
clang 3.5 | ||
Visual Studio 2013 | ||
|
||
|
||
|
||
|
||
Visual Studio 2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <spdlog/common.h> | ||
#include <map> | ||
|
||
namespace spdlog { | ||
|
||
class SPDLOG_API mdc { | ||
public: | ||
static void put(const std::string &key, const std::string &value) { | ||
get_context()[key] = value; | ||
} | ||
|
||
static std::string get(const std::string &key) { | ||
auto &context = get_context(); | ||
auto it = context.find(key); | ||
if (it != context.end()) { | ||
return it->second; | ||
} | ||
return ""; | ||
} | ||
|
||
static void remove(const std::string &key) { get_context().erase(key); } | ||
|
||
static void clear() { get_context().clear(); } | ||
|
||
static std::map<std::string, std::string> &get_context() { | ||
static thread_local std::map<std::string, std::string> context; | ||
return context; | ||
} | ||
}; | ||
|
||
} // namespace spdlog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.