diff --git a/INSTALL.md b/INSTALL.md index be310610d..a375c73e2 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -17,7 +17,7 @@ Debian and Ubuntu. The package can be installed with the usual command: ```sh # you might need sudo (or root privileges) to install -dpkg -i stumpless-2.0.0-amd64.deb +dpkg -i stumpless-2.2.0-amd64.deb ``` @@ -27,7 +27,7 @@ installed in the traditional way as well: ```sh # again, make sure you have the correct permissions -rpm -i stumpless-2.0.0-x86_64.rpm +rpm -i stumpless-2.2.0-x86_64.rpm ``` @@ -42,7 +42,7 @@ files. # you might need to do this with sudo! # make sure your permissions allow you to write to the install locations cd /usr -./stumpless-2.0.0.sh +./stumpless-2.2.0.sh ``` @@ -70,14 +70,37 @@ branches, or make any changes yourself. ## Prepping your System Since there are so many possible ways to set up an environment, stumpless does -not provide any single way to do this. However, here are some one-liners that +not provide any single way to do this. However, here are some snippets that can get everything installed for you in some common environments. +Note that some depenencies for developing Stumpless are left out of these +snippets, most notably Git, Ruby, and Valgrind. For a full list of dependencies +check the [dependency documentation](./docs/dependencies.md), which lists all of +the tools you might need. The snippets below allow you to build and test the +library, as well as build the documentation for it. + +Similarly, if you only want to build the library, you may not need all of these. +A C++ compiler is only needed to build the test suites, and doxygen is only +needed if you build the documentation. If you only want to build the library and +immediately install/use it, you will only need cmake and a C toolchain. + For Linux systems with a package manager like `apt`, you can install the needed tools (for a GNU toolchain) with something like the following: ```sh -sudo apt-get install git cmake make gcc g++ doxygen +# for distributions using apt, such as Ubuntu or Debian: +sudo apt-get install cmake make gcc g++ doxygen + +# for distributions that use pacman such as Arch Linux or MSYS2: +pacman -S cmake make gcc doxygen + +# For MinGW be sure that you use the MinGW packages, such as in the following +# pacman invocation. Be sure that you are in a MinGW shell when building this +# way. For example, MSYS2 provides some MinGW terminals. +pacman -S $MINGW_PACKAGE_PREFIX-cmake \ + $MINGW_PACKAGE_PREFIX-make \ + $MINGW_PACKAGE_PREFIX-gcc \ + $MINGW_PACKAGE_PREFIX-doxygen ``` Cygwin lacks a package manager in the environment itself, requiring packages to @@ -86,7 +109,7 @@ GUI, or if you want to just do it via command line, you can do something like this: ```sh -setup-x86_64.exe -q -P git,cmake,make,gcc-core,gcc-g++,doxygen +setup-x86_64.exe -q -P cmake,make,gcc-core,gcc-g++,doxygen ``` @@ -97,6 +120,8 @@ using `make` from a fresh clone. ```sh # cloning the latest version of the source tree +# if you don't want to use git, you can download a zip of the sources from +# github git clone git@github.com:goatshriek/stumpless.git # creating a new build directory @@ -114,18 +139,35 @@ Other environments should be built according to their normal style. For example Visual Studio provides a CMake menu in the IDE that will display all available targets. +CMake will use the build toolchain it feels is best, but on systems with +multiple available toolchains you may want to override this. For example, MinGW +systems may default to using Ninja, instead of the MinGW toolchain. In these +situations, you'll likely want to specify a +[generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) +during the configuration stage. Sticking with the MinGW case, this might look +like this: + +```sh +# run within the MinGW shell, in our fresh build directory +cmake -G "MinGW Makefiles" ../stumpless +``` + If you're unsure of the build commands for the toolchain on your system, then -cmake can run these commands for you if you invoke it in build mode. +cmake can run these commands for you if you invoke it in +[build mode](https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project). +This is especially handy in environments like Visual Studio or MinGW, where the +build toolchain might require prefixes and/or options to work properly. ```sh -# build the `all` target using whatever toolchain cmake detected during the -# configuration stage +# build the default target ("all") using whatever toolchain cmake detected +# during the configuration stage # the argument to the `--build` parameter is the root of the folder where we # ran the original cmake configuration command -cmake --build . --target all +cmake --build . -# build and run the test suite the same way -cmake --build . --target all +# we can build and run any other target with the `--target` option +# for example, this invocation builds and runs the test suite +cmake --build . --target check ``` The type of build can be changed at configuration time by defining the @@ -157,8 +199,20 @@ The rest of this documentation uses make commands for simplicity, but for any target you can build it using cmake build mode if you need truly portable command line invocation. -## Verifying your Build +## Building Documentation +The documentation for the library can be built using the `docs` target. Note +that this target will only be available if doxygen was detected during the +configuration of the system. + +```sh +# the resulting documentation will appear in a folder named docs in the build +# directory +make docs +``` + + +## Verifying your Build If you want to run the test suite on the library during development or as a sanity check before installation, you can use the `check` target to run all tests and display the results. If you're concerned that the build may not work @@ -179,8 +233,8 @@ will download and build the Google Benchmark library in order to run. make bench ``` -## Installing your Build +## Installing your Build You can use the install target to install the library on your machine after the build. @@ -248,21 +302,24 @@ cat install_manifest.txt # ``` -### Uninstalling +Some tools, such as Visual Studio, will run the installation step for you. In +Visual Studio 2022 for example, this is in the `Build->Install stumpless` menu. + +### Uninstalling There is currently no uninstall target supported, so removal of the library and its include files must be done manually if it is no longer needed. Please submit an issue on the project's Github site if you feel that you need a build -target providing this feature. For the time being, you can run the contents -of the `install_manifest.txt` file (generated during the install) through `rm` -like this: +target providing this feature. If you are on a Linux system, you can run the +contents of the `install_manifest.txt` file (generated during the install) +through `rm` like this: ```sh xargs rm < install_manifest.txt ``` -## C++ Library +## C++ Library If you want to build, test, and install the C++ bindings for stumpless as well, you will need to modify the above steps slightly. diff --git a/README.md b/README.md index 7a7418084..aa5b67c2e 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ ## Key Features Stumpless offers a robust set of features to make logging in C faster and easier: - * structured and unstructured logging to suit your needs * easy logging to [lots of things](#what-can-it-log-to) like Splunk, rsyslog, journald, the Windows Event Log, and more! + * structured and unstructured logging to suit your needs * interoperable with common log daemons and libraries - * cross-platform builds on Linux, Windows, Mac, Cygwin, and more + * builds for Linux, Windows, Mac, MinGW, MSYS2, Cygwin, and more * completely thread safe * can be adjusted or removed during compilation for zero runtime impact * localized for multiple languages :brazil: :bulgaria: :cn: :czech_republic: diff --git a/docs/dependencies.md b/docs/dependencies.md index 3a8f560dc..02621f985 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -43,12 +43,10 @@ the public header files. Documentation can also be generated using `doxygen`. This is done using the `docs` build target, which will only be available if doxygen is detected on the build system. -You can avoid downloading the repo and building the documentation by visiting -the project Github Pages website, (code is in the `gh-pages` branch of the -repository). This contains several of the documents in the `docs` folder of the -repository in a prettier format, and also uses `m.css` to generate a more -appealing and mobile-friendly doxygen page. More information on `m.css` can be -found on the [m.css project page](https://mcss.mosra.cz/). +If you only want to see the docs, you can avoid downloading the repo and +building it by visiting the project +[website](https://goatshriek.github.io/stumpless/), which has documentation for +C and C++ for the latest release. ## Development If you wish to develop within the stumpless project itself, you will need a few diff --git a/src/config/wel_supported.c b/src/config/wel_supported.c index e51e4462b..0281f08bc 100644 --- a/src/config/wel_supported.c +++ b/src/config/wel_supported.c @@ -1192,15 +1192,15 @@ stumpless_add_wel_event_source( LPCSTR subkey_name, LPCSTR param_file, DWORD types_supported ) { DWORD result = ERROR_SUCCESS; - DWORD subkey_name_length = 0; + int subkey_name_length = 0; LPCWSTR subkey_name_w; - DWORD source_name_length = 0; + int source_name_length = 0; LPWSTR source_name_w; - DWORD category_file_length = 0; + int category_file_length = 0; LPCWSTR category_file_w = NULL; - DWORD event_file_length = 0; + int event_file_length = 0; LPCWSTR event_file_w = NULL; - DWORD param_file_length = 0; + int param_file_length = 0; LPCWSTR param_file_w = NULL; VALIDATE_ARG_NOT_NULL_WINDOWS_RETURN( subkey_name ); @@ -1209,14 +1209,14 @@ stumpless_add_wel_event_source( LPCSTR subkey_name, clear_error( ); subkey_name_w = windows_copy_cstring_to_lpwstr( subkey_name, - &subkey_name_length ); + &subkey_name_length ); if( !subkey_name_w ) { result = get_windows_error_code( ); goto finish; } source_name_w = windows_copy_cstring_to_lpwstr( source_name, - &source_name_length ); + &source_name_length ); if( !source_name_w ) { result = get_windows_error_code( ); goto cleanup_subkey; @@ -1224,7 +1224,7 @@ stumpless_add_wel_event_source( LPCSTR subkey_name, if( category_file ) { category_file_w = windows_copy_cstring_to_lpwstr( category_file, - &category_file_length ); + &category_file_length ); if( !category_file_w ) { result = get_windows_error_code( ); goto cleanup_source; @@ -1233,7 +1233,7 @@ stumpless_add_wel_event_source( LPCSTR subkey_name, if( event_file ) { event_file_w = windows_copy_cstring_to_lpwstr( event_file, - &event_file_length ); + &event_file_length ); if( !event_file_w ) { result = get_windows_error_code( ); goto cleanup_category; @@ -1242,7 +1242,7 @@ stumpless_add_wel_event_source( LPCSTR subkey_name, if( param_file ) { param_file_w = windows_copy_cstring_to_lpwstr( param_file, - ¶m_file_length ); + ¶m_file_length ); if( !param_file_w ) { result = get_windows_error_code( ); goto cleanup_event;