diff --git a/.buckconfig b/.buckconfig new file mode 100644 index 00000000..e69de29b diff --git a/.gitignore b/.gitignore index b51a05b7..e7ecd21c 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ example/* !example/CMakeLists.txt !example/multisink.cpp !example/jni +!example/BUCK # generated files generated @@ -62,3 +63,13 @@ install_manifest.txt /tests/tests.VC.db /tests/tests /tests/logs/file_helper_test.txt + +# Logs +/logs/ + +# Buck +/buck-out/ +/.buckd/ +/buckaroo/ +.buckconfig.local +BUCKAROO_DEPS diff --git a/BUCK b/BUCK new file mode 100644 index 00000000..a7710963 --- /dev/null +++ b/BUCK @@ -0,0 +1,12 @@ +prebuilt_cxx_library( + name = 'spdlog', + header_namespace = 'spdlog', + header_only = True, + exported_headers = subdir_glob([ + ('include/spdlog', '**/*.h'), + ('include/spdlog', '**/*.cc'), + ]), + visibility = [ + 'PUBLIC', + ], +) diff --git a/README.md b/README.md index f5e5fe34..9a411fdd 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci. * Fedora: `yum install spdlog` * Arch Linux: `pacman -S spdlog-git` * vcpkg: `vcpkg install spdlog` - +* Buckaroo: `buckaroo install gabime/spdlog` + ## Platforms * Linux, FreeBSD, Solaris @@ -66,6 +67,15 @@ Time needed to log 1,000,000 lines in asynchronous mode, i.e. the time it takes |100| 0.959s |0.202s| +## Buck + +The test, examples and benchmarks can be run using [Buck](https://www.buckbuild.com): + +```bash +buck run example/ +buck run example/:bench +buck run tests/ +``` ## Usage Example @@ -97,10 +107,10 @@ int main(int, char*[]) console->info("Support for floats {:03.2f}", 1.23456); console->info("Positional args are {1} {0}..", "too", "supported"); console->info("{:<30}", "left aligned"); - + spd::get("console")->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name) function"); - + // Create basic file logger (not rotated) auto my_logger = spd::basic_logger_mt("basic_logger", "logs/basic.txt"); my_logger->info("Some log message"); @@ -177,7 +187,7 @@ void async_example() //syslog example void syslog_example() { -#ifdef SPDLOG_ENABLE_SYSLOG +#ifdef SPDLOG_ENABLE_SYSLOG std::string ident = "spdlog-example"; auto syslog_logger = spd::syslog_logger("syslog", ident, LOG_PID); syslog_logger->warn("This is warning that will end up in syslog.."); @@ -205,10 +215,10 @@ void user_defined_example() //custom error handler // void err_handler_example() -{ +{ spdlog::set_error_handler([](const std::string& msg) { std::cerr << "my err handler: " << msg << std::endl; - }); + }); // (or logger->set_error_handler(..) to set for specific logger) } diff --git a/example/BUCK b/example/BUCK new file mode 100644 index 00000000..14b32956 --- /dev/null +++ b/example/BUCK @@ -0,0 +1,25 @@ +cxx_binary( + name = 'example', + srcs = [ + 'example.cpp', + ], + compiler_flags = [ + '-std=c++14', + ], + deps = [ + '//:spdlog', + ], +) + +cxx_binary( + name = 'bench', + srcs = [ + 'bench.cpp', + ], + compiler_flags = [ + '-std=c++14', + ], + deps = [ + '//:spdlog', + ], +) diff --git a/tests/BUCK b/tests/BUCK new file mode 100644 index 00000000..05b386c7 --- /dev/null +++ b/tests/BUCK @@ -0,0 +1,17 @@ +cxx_binary( + name = 'tests', + header_namespace = '', + headers = glob([ + '*.h', + '*.hpp', + ]), + srcs = glob([ + '*.cpp', + ]), + compiler_flags = [ + '-std=c++14', + ], + deps = [ + '//:spdlog', + ], +)