Commit 06889e73 authored by Adrien Oliva's avatar Adrien Oliva

Merge branch '4-packaging' into 'master'

Resolve "Packaging"

Closes #4

See merge request !4
parents 70bba72d f828f788
Pipeline #222 passed with stages
in 1 minute and 18 seconds
1 Adrien Oliva <olivaa+gitlab@yapbreak.fr>
9 Adrien Oliva <olivaa+gitlab@yapbreak.fr>
# ChangeLog
2018-07-17 Adrien Oliva <olivaa@yapbreak.fr>
* Initial release of libyaplog
2018-07-17 Adrien Oliva <olivaa@yapbreak.fr>
* GTLAB #3 - Remove CSER reference
2018-07-12 Adrien Oliva <olivaa@yapbreak.fr>
* GTLAB #2 - Improve test
* GTLAB #1 - Import logger from libcomserial
# NEWS
## Version 1.0.0
* initial release
[![pipeline status](https://gitlab.yapbreak.fr/libraries/libyaplog/badges/master/pipeline.svg)](https://gitlab.yapbreak.fr/libraries/libyaplog/commits/master)
[![coverage report](https://gitlab.yapbreak.fr/libraries/libyaplog/badges/master/coverage.svg)](https://gitlab.yapbreak.fr/libraries/libyaplog/commits/master)
This library is released under the terms of WTF-PL:
# Purpose
```
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
This directory contains the source code of Yaplog library.
The YapLog library is a free software. See COPYING file for copying permission.
Copyright (C) 2018 Adrien Oliva <olivaa+gitlab@yapbreak.fr>
It provides a basic logger functionnality for C++ application.
See files in samples folder for example on how to use it.
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
# Installation
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
To compile and install the library, simply run the following commands:
0. You just DO WHAT THE FUCK YOU WANT TO.
```bash
./autogen.sh
./configure
make
make check # (optional)
make doc # (generate documentation)
sudo make install
```
/**
* This is a simple yaplog sample.
*
* To compile this sample, use the following commands:
*
* g++ -o custom.o -c custom.cpp $(pkg-config --cflags yaplog)
* g++ -o custom custom.o $(pkg-config --libs yaplog)
*
* Then, set variable Customvariable and Customdestination to control logs
* output.
*/
#include <iostream>
#include <yaplog.h>
int main(int argc, const char *argv[])
{
logger::setLevelVariable("Customvariable");
logger::setDestinationVariable("Customdestination");
int value = 42;
const char *cstring = "<Works with cstring>";
char test[225];
FLOG() << "This is a fatal message.";
ALOG() << "Alert triggered by " << value;
CLOG() << "Critical error detected in C string " << cstring;
ELOG() << "Even buffer could be logged";
WLOG() << "See this dump if you set Customvariable=6";
NLOG() << logger::dump(test, sizeof(test));
ILOG() << "Information message";
DLOG() << "Not many people will read this as this is debug";
TLOG() << "Do not know why I have another level below debug...";
return EXIT_SUCCESS;
}
/**
* This is a simple yaplog sample.
*
* To compile this sample, use the following commands:
*
* g++ -o sample.o -c sample.cpp $(pkg-config --cflags yaplog)
* g++ -o sample sample.o $(pkg-config --libs yaplog)
*
* Then, set variable LOGLEVEL and LOGDESTINATION to control logs output:
*/
#include <iostream>
#include <yaplog.h>
int main(int argc, const char *argv[])
{
int value = 42;
const char *cstring = "<Works with cstring>";
char test[225];
FLOG() << "This is a fatal message.";
ALOG() << "Alert triggered by " << value;
CLOG() << "Critical error detected in C string " << cstring;
ELOG() << "Even buffer could be logged";
WLOG() << "See this dump if you set LOGLEVEL=6";
NLOG() << logger::dump(test, sizeof(test));
ILOG() << "Information message";
DLOG() << "Not many people will read this as this is debug";
TLOG() << "Do not know why I have another level below debug...";
return EXIT_SUCCESS;
}
......@@ -2,6 +2,7 @@
#define YAPLOG_H_UGV90DZC
#include <yaplog/internallog.h>
#include <yaplog/dump.h>
/**
* @brief Fatal log macro utility to print a fatal message on stderr.
......
......@@ -10,4 +10,5 @@ libinternalyaplog_la_SOURCES += internallog.cpp
libinternalyaplog_la_SOURCES += level.h
libinternalyaplog_la_SOURCES += loglocation.h
include_HEADERS = dump.h internallog.h level.h loglocation.h
yaplogdir = $(includedir)/yaplog
yaplog_HEADERS = dump.h internallog.h level.h loglocation.h
......@@ -80,9 +80,3 @@ std::string dump::get_formatted_string() const
return output.str();
}
inline std::ostream &operator<<(std::ostream &out, const dump &data)
{
out << data.get_formatted_string();
return out;
}
......@@ -52,7 +52,11 @@ namespace logger {
*
* @return Reference to the used output stream.
*/
inline std::ostream &operator<<(std::ostream &out, const dump &data);
inline std::ostream &operator<<(std::ostream &out, const dump &data)
{
out << data.get_formatted_string();
return out;
}
};
#endif /* end of include guard: YAPLOG_DUMP_H_9LPSDK6A */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment