http://www.loggly.com/ultimate-guide/
https://www.elastic.co/blog/structured-logging-filebeat
https://habrahabr.ru/post/313686/ C++ logging comparison
http://habrahabr.ru/post/225363/
https://github.com/gabime/spdlog
http://www.drdobbs.com/article/print?articleId=201804215&siteSectionName=cpp
http://www.drdobbs.com/article/print?articleId=221900468&siteSectionName=cpp
http://www.drdobbs.com/article/print?articleId=225700666&siteSectionName=cpp
http://www.drdobbs.com/cpp/a-lightweight-logger-for-c/240147505
http://www.embeddedrelated.com/showarticle/518.php
http://newbiz.developpez.com/tutoriels/cpp/log-en/
https://github.com/ntpeters/SimpleLogger
http://logging.apache.org/log4j/2.x/manual/async.html#Performance
::openlog(moduleName, logName)
::syslog(LogLevel, mylogmessage);
::closelog();
http://code.google.com/p/google-glog/
http://www.yolinux.com/TUTORIALS/Log4cxx.html
http://accu.org/index.php/journals/1304
http://www.techrepublic.com/article/use-stl-streams-for-easy-c-thread-safe-logging/5072104
http://stackoverflow.com/questions/439791/what-is-the-most-efficient-thread-safe-c-logger
http://stackoverflow.com/questions/1736295/c-logging-framework-suggestions
http://stackoverflow.com/questions/5028302/small-logger-class
http://www.inspirel.com/articles/Atomic_Log_Stream.html
Logging
http://sathyamvellal.in/blog/cool-c-programming/?d=5
https://github.com/SergiusTheBest/plog
http://habrahabr.ru/post/148781/
http://flouthoc.github.io/logr.h/
http://www.reddit.com/r/cpp/comments/za6ts/can_i_have_some_feedback_on_a_logger_i_coded/ http://www.reddit.com/r/cpp/comments/2n9tt7/new_minimalisic_but_fast_asynchronous_data_logger/
http://solid-angle.blogspot.com/2011/02/lazy-logging-parameter-evaluation-with.html
http://habrahabr.ru/blogs/cpp/131977/
http://habrahabr.ru/blogs/cpp/138150/
http://drdobbs.com/cpp/201804215?itc=dobbs-callout-mostpop
http://www.geeksforgeeks.org/archives/22027
#include <stdio.h>
#define INFO 1
#define ERR 2
#define STD_OUT stdout
#define STD_ERR stderr
#define LOG_MESSAGE(prio, stream, msg, ...) do {\
char *str;\
if (prio == INFO)\
str = "INFO";\
else if (prio == ERR)\
str = "ERR";\
fprintf(stream, "[%s] : %s : %d : "msg" \n", \
str, __FILE__, __LINE__, ##__VA_ARGS__);\
} while (0)
int main(void){
char *s = "Hello";
LOG_MESSAGE(ERR, STD_ERR, "Failed to open file"); /* display normal message */
LOG_MESSAGE(INFO, STD_OUT, "%s Geeks for Geeks", s); /* provide string as argument */
LOG_MESSAGE(INFO, STD_OUT, "%d + %d = %d", 10, 20, (10 + 20)); /* provide integer as arguments */
return 0;
}
YET ANOTHER LOGGER CLASS http://cplusplus.co.il/2009/11/18/scopelogger/#more-609
// ---- header ---- #include <string> // Following macro is not entirely portable, but works in MSVS & GCC #define LOG_FUNC ScopeLogger s##__LINE__(__FUNCTION__) struct ScopeLogger { ScopeLogger (const std::string &str); ~ScopeLogger (); private: std::string indent (unsigned ind) const; static unsigned indent_; const std::string msg_; }; // ---- source ---- #include <iostream> unsigned ScopeLogger::indent_ = 0; ScopeLogger::ScopeLogger (const std::string &str) : msg_(str) { std::cout << indent(indent_++) << "[+] " << msg_ << std::endl; } ScopeLogger::~ScopeLogger () { std::cout << indent(--indent_) << "[-] " << msg_ << std::endl; } std::string ScopeLogger::indent (unsigned ind) const { return std::string(ind<<1, ' '); }
Usage:
#include "scopelogger.h" bool run () { LOG_FUNC; static unsigned num = 1; return num--; } void attempt () { LOG_FUNC; } bool work () { LOG_FUNC; static bool state = true; if (state) attempt(); return state -= state; } int main () { LOG_FUNC; while (run()) if (!work()) attempt(); return 0; }