* Implemented Buck builds

pull/448/head
njlr 8 years ago
parent f85a08622e
commit 24c0495c34

11
.gitignore vendored

@ -47,6 +47,7 @@ example/*
!example/CMakeLists.txt !example/CMakeLists.txt
!example/multisink.cpp !example/multisink.cpp
!example/jni !example/jni
!example/BUCK
# generated files # generated files
generated generated
@ -62,3 +63,13 @@ install_manifest.txt
/tests/tests.VC.db /tests/tests.VC.db
/tests/tests /tests/tests
/tests/logs/file_helper_test.txt /tests/logs/file_helper_test.txt
# Logs
/logs/
# Buck
/buck-out/
/.buckd/
/buckaroo/
.buckconfig.local
BUCKAROO_DEPS

12
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',
],
)

@ -16,7 +16,8 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci.
* Fedora: `yum install spdlog` * Fedora: `yum install spdlog`
* Arch Linux: `pacman -S spdlog-git` * Arch Linux: `pacman -S spdlog-git`
* vcpkg: `vcpkg install spdlog` * vcpkg: `vcpkg install spdlog`
* Buckaroo: `buckaroo install gabime/spdlog`
## Platforms ## Platforms
* Linux, FreeBSD, Solaris * 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| |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 ## Usage Example
@ -97,10 +107,10 @@ int main(int, char*[])
console->info("Support for floats {:03.2f}", 1.23456); console->info("Support for floats {:03.2f}", 1.23456);
console->info("Positional args are {1} {0}..", "too", "supported"); console->info("Positional args are {1} {0}..", "too", "supported");
console->info("{:<30}", "left aligned"); console->info("{:<30}", "left aligned");
spd::get("console")->info("loggers can be retrieved from a global registry using the spdlog::get(logger_name) function"); 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) // Create basic file logger (not rotated)
auto my_logger = spd::basic_logger_mt("basic_logger", "logs/basic.txt"); auto my_logger = spd::basic_logger_mt("basic_logger", "logs/basic.txt");
my_logger->info("Some log message"); my_logger->info("Some log message");
@ -177,7 +187,7 @@ void async_example()
//syslog example //syslog example
void syslog_example() void syslog_example()
{ {
#ifdef SPDLOG_ENABLE_SYSLOG #ifdef SPDLOG_ENABLE_SYSLOG
std::string ident = "spdlog-example"; std::string ident = "spdlog-example";
auto syslog_logger = spd::syslog_logger("syslog", ident, LOG_PID); auto syslog_logger = spd::syslog_logger("syslog", ident, LOG_PID);
syslog_logger->warn("This is warning that will end up in syslog.."); syslog_logger->warn("This is warning that will end up in syslog..");
@ -205,10 +215,10 @@ void user_defined_example()
//custom error handler //custom error handler
// //
void err_handler_example() void err_handler_example()
{ {
spdlog::set_error_handler([](const std::string& msg) { spdlog::set_error_handler([](const std::string& msg) {
std::cerr << "my err handler: " << msg << std::endl; std::cerr << "my err handler: " << msg << std::endl;
}); });
// (or logger->set_error_handler(..) to set for specific logger) // (or logger->set_error_handler(..) to set for specific logger)
} }

@ -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',
],
)

@ -0,0 +1,17 @@
cxx_binary(
name = 'tests',
header_namespace = '',
headers = glob([
'*.h',
'*.hpp',
]),
srcs = glob([
'*.cpp',
]),
compiler_flags = [
'-std=c++14',
],
deps = [
'//:spdlog',
],
)
Loading…
Cancel
Save