Skip to content

Commit

Permalink
Switch to use CHANGELOG and split from README (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
guangie88 authored Sep 17, 2018
1 parent cb9a6ac commit d21ceba
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 69 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Changelog

## Unreleased

- Add functions that allow configuration overrides:
- `from_file_and_override`
- `from_file_and_override_with_tag_replacement`
- `save_logger_to_file`
- `delete_logger_in_file`
- Fix CMake package finding failure when installed using submodule `spdlog`
([#23](https://github.com/guangie88/spdlog_setup/issues/23))
- Fix global pattern not used by subsequent loggers other than the first
([#19](https://github.com/guangie88/spdlog_setup/issues/19)).

## v0.2

- Use `spdlog_setup/conf.h` instead of `spdlog_setup.h`. Reason for change is
to allow inlining of `cpptoml` and `fmt` libraries.
- No changes to the `TOML` configuration format.
- Switch back to exception based strategy for handling error.
`spdlog_setup::setup_error` exception contains error messages similar to
`v0.1`. Rationale of change is to align to C++ idiomatic approach of using
exception of handling error.
- Change to exception based handling means a change of API, so check out the
[examples](./README.md#use-examples) to observe the changes.
- Strip down many `git` submodules, leaving only `Catch2` (unit-test) and
`spdlog` only, which is much better for installation. For `spdlog`, it is
replaceable and likely to work if replaced with custom and newer versions,
unless there are major API changes.

## v0.1

- Basic implementation that reads from TOML configuration for set-up.
126 changes: 57 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,47 +23,35 @@ of the functions.

Tested against:

* `g++-4.9`
* `g++-5`
* `g++-6`
* `g++-7`
* `clang-3.4`
* `clang-3.5`
* `clang-3.6`
* `clang-3.7`
* `clang-3.8`
* `clang-3.9`
* `clang-4.0`
* `clang-5.0`
* `clang-6.0`
* `cl` (v140 / MSVC2015)
* `cl` (v141 / MSVC2017)
- `g++-4.9`
- `g++-5`
- `g++-6`
- `g++-7`
- `clang-3.4`
- `clang-3.5`
- `clang-3.6`
- `clang-3.7`
- `clang-3.8`
- `clang-3.9`
- `clang-4.0`
- `clang-5.0`
- `clang-6.0`
- `cl` (v140 / MSVC2015)
- `cl` (v141 / MSVC2017)

## Features

* Header-only (check [`How to Install`](#how-to-install) to extract out the
- Header-only (check [`How to Install`](#how-to-install) to extract out the
header files).
* Initialization of `spdlog` sinks, patterns and loggers based on `TOML`
- Initialization of `spdlog` sinks, patterns and loggers based on `TOML`
configuration file.
* Tag replacement (e.g. "{tagname}-log.txt") within the `TOML` configuration
- Tag replacement (e.g. "{tagname}-log.txt") within the `TOML` configuration
file.
* Throw exception describing the error during the parsing of the config file.

## Difference from `v0.1` to `v0.2`

* Use `spdlog_setup/conf.h` instead of `spdlog_setup.h`. Reason for change is
to allow inlining of `cpptoml` and `fmt` libraries.
* No changes to the `TOML` configuration format.
* Back to exception based strategy for handling error.
`spdlog_setup::setup_error` exception contains error messages similar to
`v0.1`. Rationale of change is to align to C++ idiomatic approach of using
exception of handling error.
* Changing to exception based handling means a change of API, so check out the
[examples](#use-examples) to observe the changes.
* Stripped down many `git` submodules, leaving only `Catch2` (unit-test) and
`spdlog` only, which is much better for installation. For `spdlog`, it is
replaceable and likely to work if replaced with custom and newer versions,
unless there are major API changes.
- Throw exception describing the error during the parsing of the config file.

## Changelog

See [CHANGELOG.md](./CHANGELOG.md) for more details.

## Repository Checkout

Expand All @@ -80,14 +68,14 @@ submodule dependencies.

This repository uses the following external dependencies directly:

* [`Catch`](https://github.com/philsquared/Catch) (only for unit-tests, not
- [`Catch`](https://github.com/philsquared/Catch) (only for unit-tests, not
included in installation)
* [`spdlog`](https://github.com/gabime/spdlog)
- [`spdlog`](https://github.com/gabime/spdlog)

In addition, the following dependencies are inlined as part of the include:

* [`cpptoml`](https://github.com/skystrife/cpptoml)
* [`fmt`](https://github.com/fmtlib/fmt.git)
- [`cpptoml`](https://github.com/skystrife/cpptoml)
- [`fmt`](https://github.com/fmtlib/fmt.git)

## How to Build

Expand All @@ -113,20 +101,20 @@ In the root directory after `git` cloning:

#### Debug without Installation

* `mkdir build-debug`
* `cd build-debug`
* `cmake .. -DCMAKE_BUILD_TYPE=Debug -DSPDLOG_SETUP_INCLUDE_UNIT_TESTS=ON`
* `cmake --build .`
- `mkdir build-debug`
- `cd build-debug`
- `cmake .. -DCMAKE_BUILD_TYPE=Debug -DSPDLOG_SETUP_INCLUDE_UNIT_TESTS=ON`
- `cmake --build .`

Now the unit test executable should be compiled and residing in
`build-debug/spdlog_setup_unit_test`.

#### Release with Installation

* `mkdir build-release`
* `cd build-release`
* `cmake .. -DCMAKE_BUILD_TYPE=Release -DSPDLOG_SETUP_INCLUDE_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install`
* `cmake --build . --target install`
- `mkdir build-release`
- `cd build-release`
- `cmake .. -DCMAKE_BUILD_TYPE=Release -DSPDLOG_SETUP_INCLUDE_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install`
- `cmake --build . --target install`

Now the unit test executable should be compiled and residing in
`build-release/spdlog_setup_unit_test`.
Expand All @@ -141,34 +129,34 @@ and [`Visual C++ Build Tools 2015`](http://landinghub.visualstudio.com/visual-cp

In the root directory after `git` cloning:

* `mkdir build`
* `cd build`
* `cmake .. -G "Visual Studio 14 Win64" -DSPDLOG_SETUP_INCLUDE_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install`
* (Debug) `cmake --build . --config Debug`
* (Release with installation) `cmake --build . --config Release --target install`
- `mkdir build`
- `cd build`
- `cmake .. -G "Visual Studio 14 Win64" -DSPDLOG_SETUP_INCLUDE_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install`
- (Debug) `cmake --build . --config Debug`
- (Release with installation) `cmake --build . --config Release --target install`

Now the unit test executable should be compiled and residing in

* (Debug) `build/Debug/spdlog_setup_unit_test.exe` or
* (Release) `build/Release/spdlog_setup_unit_test.exe`.
- (Debug) `build/Debug/spdlog_setup_unit_test.exe` or
- (Release) `build/Release/spdlog_setup_unit_test.exe`.

The header files should be installed in `build/install/include`.

## Supported Sinks

* `stdout_sink_st`
* `stdout_sink_mt`
* `color_stdout_sink_st`
* `color_stdout_sink_mt`
* `simple_file_sink_st`
* `simple_file_sink_mt`
* `rotating_file_sink_st`
* `rotating_file_sink_mt`
* `daily_file_sink_st`
* `daily_file_sink_mt`
* `null_sink_st`
* `null_sink_mt`
* `syslog_sink` (only for Linux, `SPDLOG_ENABLE_SYSLOG` preprocessor definition
- `stdout_sink_st`
- `stdout_sink_mt`
- `color_stdout_sink_st`
- `color_stdout_sink_mt`
- `simple_file_sink_st`
- `simple_file_sink_mt`
- `rotating_file_sink_st`
- `rotating_file_sink_mt`
- `daily_file_sink_st`
- `daily_file_sink_mt`
- `null_sink_st`
- `null_sink_mt`
- `syslog_sink` (only for Linux, `SPDLOG_ENABLE_SYSLOG` preprocessor definition
must be defined before any `spdlog`/`spdlog_setup` header is included)

Currently `ostream_sink` and `dist_sink` do not fit into the use case and are
Expand Down Expand Up @@ -418,9 +406,9 @@ int main(const int argc, const char * argv[]) {
## Notes
* Make sure that the directory for the log files to reside in exists before
- Make sure that the directory for the log files to reside in exists before
using `spdlog`, unless the `create_parent_dir` flag is set to true for the
sink.
* For the current set of unit tests, the working directory must be at the git
- For the current set of unit tests, the working directory must be at the git
root directory or in `build` directory so that the TOML configuration files in
`config` directory can be found.

0 comments on commit d21ceba

Please sign in to comment.