Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Release 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
naccyde committed Dec 11, 2018
1 parent f77b09f commit 2da706d
Show file tree
Hide file tree
Showing 54 changed files with 627 additions and 564 deletions.
3 changes: 0 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ environment:
platform: x64
generator: "Visual Studio 12 2013 Win64"

install:
- cmd: choco install doxygen.install

before_build:
- cd c:\yall
- cmake -G"%generator%"
Expand Down
4 changes: 2 additions & 2 deletions .sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#

sonar.projectName=yall
sonar.projectKey=yall
sonar.organization=default
sonar.projectKey=naccyde_yall
sonar.organization=naccyde-github

sonar.projectDescription=C light logging library

Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
120
],
},
"C_Cpp.autoAddFileAssociations": false
"C_Cpp.autoAddFileAssociations": false,
"files.associations": {
"*.h":"c"
}
}
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

## [1.8.1]
### Added
* `CONTRIBUTING.md`
* Check parameter's output file when calling `_get_subsystem()`
### Changed
* Enforce use of explicit data types (e.g. `int32_t` instead of `int`)
* Remove call data limited line length
* Change `init_call_data()` to `call_new()` and `call_delete()`
* Use `llist` instead of a custom linked-list for call data
### Deprecated
### Removed
* `coverage.py` for Codacy coverage
* `message_delete_wrapper()` function
* `convert_data_to_message()` function
### Fixed
* Show subsystems names inside tree ([#146](https://github.com/naccyde/yall/issues/176))
* Update subsystem name correctly when using an existing subsystem name
* Removing a subsystem now display the proper log message
### Security

## [1.8.0]
### Added
* Queue (non concurrent) mechanism
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ endif ()
find_package(jansson REQUIRED)
find_package(pthread REQUIRED)
find_package(criterion REQUIRED)
find_package(Doxygen REQUIRED)

if (UNIX)
find_package(Doxygen REQUIRED)
endif ()

#[[
Project version
Expand Down
117 changes: 89 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,89 @@
# yall contributing guide

## Unit tests

Unit tests have to be organized the following way:

```
tests
├─ <source_file>
│ ├─ test_<function>.c
│ ├─ test_<function>.c
│ ├─ test.c
│ └─ test.h
├─ <source_file>
│ ├─ test_<function>.c
│ ├─ test_<function>.c
│ ├─ test.c
│ └─ test.h
...
├─ test.c
└─ yall_test.h
```

This way, `test.h` and `test.c` files in each folder will store fixtures for the given source file.

Then, each test case should describe a specific way of using the function, or should aim to trigger a particular error returned by the function.

Global coverage percentage should be at least 95%, otherwise continuous integration will fail. This is required in order to ensure most part of the library is covered by unit test and reduce potential errors. Following this logic, once a bug is found in the library, a test case reproducing it should first be wrote, this allow to check its resolution and avoid regressions.
# Contributing to `yall`

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Documentation about how to use `yall` is available on the [project website](https://naccyde.github.io/yall/). This website also hosts [Doxygen](https://naccyde.github.io/yall/doxygen/index.html) and [lcov](https://naccyde.github.io/yall/coverage/index.html) documentation.

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
2. Update the documentation with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters. Doxygen documentation must be wrote to explain the new code (if any).
3. Update `CHANGELOG.md` to explain the modifications.
4. Ensure everything is working by running `make test` and `make doc` for both `Release` and `Debug` build.

## Code of Conduct

### Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

### Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

### Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

### Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# yall

[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Naccyde/yall/develop/LICENSE)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/naccyde/yall/master/LICENSE)
[![Travis (.org) branch](https://img.shields.io/travis/naccyde/yall/master.svg?label=Linux)](https://travis-ci.com/naccyde/yall)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/naccyde/yall/master.svg?label=Windows)](https://ci.appveyor.com/project/Naccyde/yall)
[![SonarQube Coverage](https://img.shields.io/sonar/http/sonarcloud.io/yall/coverage.svg)](https://sonarcloud.io/dashboard?id=naccyde_yall)
[![SonarQube Tech Debt](https://img.shields.io/sonar/http/sonarcloud.io/yall/tech_debt.svg)](https://sonarcloud.io/dashboard?id=naccyde_yall)

[![!][1b]][1l] [![!][2b]][2l] [![!][3b]][3l] [![!][4b]][4l]

`yall` is a subsystems based logging library. It allow to handle multiple ways to log message for differents parts of an application thanks to subsystems creation. Subsystems can inherit from one another, override parents parameters, ...
`yall` is a subsystems based logging library. It allows to create subsystems which will manage all the logging parameters for an area of the application. Subsystems can inherit from one another, override parents parameters...

`yall` is available on Linux and Windows (MSVC12 and MSVC14).


## How to use

Informations about how to use `yall` can be found on the [project wiki](https://naccyde.github.io/yall/).

Informations about how to use `yall` can be found on the [project wiki](https://naccyde.gitlab.io/yall/). As the documentation is under redaction, the old one can be found in [Git history](https://gitlab.com/naccyde/yall/blob/755569d405948297665aeaad41d4bb9f7856ad35/README.md).

The major steps are :
The main workflow to use yall is the following:
* Initialize the library
* Create subsystems
* Log messages
Expand All @@ -35,10 +36,10 @@ Git LFS is required to clone the repository. yall use CMake as build system gene

Then :

cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=<Release|Debug>
cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release
make -C build

Launched inside the sources directory, these commands will create a `build` directory to run CMake inside, and build the library. The `CMAKE_BUILD_TYPE` variable will define what will be installed. On `Release` build, only required parts to use the library will be build and installed. On `Debug` build, all the required file to build with the library will be build and installed.
Launched inside the sources directory, these commands will create a `build` directory to run CMake inside, and build the library. The `CMAKE_BUILD_TYPE` variable will define what will be installed. `Release` here can be changed to `Debug`, to build the library with the debug symbols.

On Windows, the process is straightforward using CMake GUI and Visual Studio.

Expand All @@ -61,16 +62,5 @@ The way to contribute to the project is define is `CONTRIBUTING.md` (currently u

For any problem that can't be solved using `Debugging` section of the documentation, there is multiple solutions :

* Create an [issue](https://gitlab.com/naccyde/yall/issues) on the project, following the template.
* Send a mail to the project's service desk : `incoming+naccyde/yall <at> gitlab <dot> com`.
* Send a mail to the maintainer : `naccyde <at> naccyde <dot> eu`.


[1b]: https://gitlab.com/naccyde/yall/badges/master/pipeline.svg
[1l]: https://gitlab.com/naccyde/yall/commits/master
[2b]: https://sonarcloud.io/api/badges/gate?key=yall
[2l]: https://sonarcloud.io/dashboard?id=yall
[3b]: https://sonarcloud.io/api/badges/measure?key=yall&metric=coverage
[3l]: https://sonarcloud.io/dashboard?id=yall
[4b]: https://sonarcloud.io/api/badges/measure?key=yall&metric=sqale_debt_ratio
[4l]: https://sonarcloud.io/dashboard?id=yall
* Fork the repository and create a pull-request.
4 changes: 4 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ add_custom_target(_user_doc

add_custom_target(doc
DEPENDS _doxygen_doc _coverage_doc _user_doc)

if (WIN32)
set_target_properties(doc PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif ()
39 changes: 16 additions & 23 deletions include/yall/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include <stddef.h>

#include "yall/utils.h"

#define DEFAULT_LINE_SIZE 1024U
#include "yall/container/llist.h"

/**
* \struct yall_call_data_line
Expand Down Expand Up @@ -63,41 +62,35 @@ struct yall_call_data_line {
typedef struct yall_call_data {
size_t message_size;
char *header;
struct yall_call_data_line *lines;
llist_t *lines;
} yall_call_data;

/**
* \brief Initialize a structure yall_call_data by setting header to "\n" and
* message_size to 1.
* \param d Pointer to structure of type yall_call_data. Can't be NULL.
* \brief Create a new yall_call_data object and return its pointer.
* \return Pointer to a new yall_call_data object.
*/
void init_call_data(struct yall_call_data *d);
yall_call_data *call_new(void);

/**
* \brief Add a line to the structure yall_call_data with the given content.
* \param d Pointer to structure of type yall_call_data. Can't be NULL.
* \param content Nul-terminated string to add as a line on the final log
* message can't be NULL.
* \brief Delete the given yall_call_data object (including header and lines).
* \param Pointer to a valid yall_call_data object.
*/
void add_line(struct yall_call_data *d, char *content);
void call_delete(yall_call_data *d);

/**
* \brief Remove and return the first line of the given yall_call_data.
* \param d Pointer to structure of type yall_call_data. Can't be NULL.
* \return First line of the given yall_call_data.
* \brief Return the computed length of the buffer to allocate in order to
* store the full message, including '\0'.
* \param d Pointer to a yall_call_data object.
* \return Minimal size of the buffer to store the message.
*/
struct yall_call_data_line *remove_first_line(struct yall_call_data *d);
size_t call_get_buffer_length(yall_call_data *d);

/**
* \brief Convert the content of the structure yall_call_data to a
* nul-terminated string inside *buffer* parameter. Limited to *len* bytes.
* \param buffer Buffer to write the log message in.
* \param len Maximum length of characters to write inside *buffer* including
* nul-terminating '\0'.
* \brief Remove and return the first line of the given yall_call_data.
* \param d Pointer to structure of type yall_call_data. Can't be NULL.
* \return First line of the given yall_call_data.
*/
void convert_data_to_message(char *buffer, size_t len,
struct yall_call_data *d);
struct yall_call_data_line *remove_first_line(struct yall_call_data *d);

/**
* \brief Called by the user's formatter function, it allow to define the header
Expand Down
3 changes: 3 additions & 0 deletions include/yall/container/llist.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define _YALL_CONTAINER_LLIST_H

#include <stdint.h>
#include <stddef.h>

typedef struct llist_node_t llist_node_t;
typedef struct llist_t llist_t;
Expand All @@ -50,6 +51,8 @@ llist_t *ll_new(void);
*/
void ll_delete(llist_t *l, void (*data_delete)(void *data));

size_t ll_get_size(llist_t *l);

/**
* \brief Insert the data at the given position. If the position does not exists
* in the list (insert at index 40 in a list composed of 3 elements, for
Expand Down
2 changes: 1 addition & 1 deletion include/yall/cpp/Yall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class YallException : public std::exception

private:
std::string msg;
int num;
yall_error num;
};

class YallData
Expand Down
10 changes: 1 addition & 9 deletions include/yall/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ struct message *message_new(char *data,
*/
void message_delete(struct message *msg);

/**
* \brief Used to suppress warnings as function deleting the message is called
* by a function requiring it to be as void (*)(void *).
* TODO: Delete
* \param msg Message to delete. Can't be NULL.
*/
void message_delete_wrapper(void *msg);

/**
* \brief Create the log message. It fills *buffer* we given data and specific
* format. By the way, the function returns the required buffer size of the
Expand All @@ -117,6 +109,6 @@ size_t generate_std_msg(char *log_buffer, size_t len,
* \param len Length of the log buffer.
* \param d Call data to generate the log message from.
*/
void generate_call_msg(char *buffer, size_t len, struct yall_call_data *d);
void generate_call_msg(char *buff, size_t len, struct yall_call_data *d);

#endif
2 changes: 1 addition & 1 deletion include/yall/subsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ struct yall_subsystem *create_subsystem(const char *name,
void add_subsystem(const char *parent, struct yall_subsystem *s);

/**
* \brief Update a given subsystem : from an existing subsystem it upadte its
* \brief Update a given subsystem : from an existing subsystem it update its
* parameters instead of creating a new one.
* \param s The subsystem to update.
* \param log_level New log level of the subsystem.
Expand Down
2 changes: 1 addition & 1 deletion resources/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ sonar-scanner \
-Dsonar.cfamily.build-wrapper-output=${YALL_ROOT}/build/out/bw \
-Dsonar.projectBaseDir=${YALL_ROOT} \
-Dsonar.cfamily.gcov.reportsPath=${YALL_ROOT}/build/out/coverage \
-Dsonar.login=${SONAR_API_KEY} \
-Dsonar.login=${SONAR_TOKEN} \
-Dsonar.projectVersion=${TRAVIS_TAG} ${SONAR_EXTRA_OPTIONS}
Loading

0 comments on commit 2da706d

Please sign in to comment.