All Projects → DNKpp → Simple-Log

DNKpp / Simple-Log

Licence: BSL-1.0 license
dnkpp.github.io/Simple-Log/

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to Simple-Log

sqlite micro logger arduino
Fast and Lean Sqlite database logger for Microcontrollers
Stars: ✭ 128 (+884.62%)
Mutual labels:  logger, logging-library
Timber Elixir
🌲 Great Elixir logging made easy
Stars: ✭ 226 (+1638.46%)
Mutual labels:  logger, logging-library
Quill
Asynchronous Low Latency C++ Logging Library
Stars: ✭ 422 (+3146.15%)
Mutual labels:  logger, logging-library
Electron Timber
Pretty logger for Electron apps
Stars: ✭ 337 (+2492.31%)
Mutual labels:  logger, logging-library
RxLogs
An Android & Kotlin Reactive Advanced Logging Framework.
Stars: ✭ 12 (-7.69%)
Mutual labels:  logger, logging-library
Tinylog
tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android
Stars: ✭ 360 (+2669.23%)
Mutual labels:  logger, logging-library
Ring Log
Ring-Log是一个高效简洁的C++异步日志, 其特点是效率高(每秒支持至少125万+日志写入)、易拓展,尤其适用于频繁写日志的场景
Stars: ✭ 201 (+1446.15%)
Mutual labels:  logger, logging-library
winston-telegram
A Telegram transport for winston
Stars: ✭ 28 (+115.38%)
Mutual labels:  logger, logging-library
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (+100%)
Mutual labels:  logger, logging-library
JJSwiftLog
Swift log library for all platform
Stars: ✭ 51 (+292.31%)
Mutual labels:  logger, logging-library
Tslog
📝 tslog - Expressive TypeScript Logger for Node.js.
Stars: ✭ 321 (+2369.23%)
Mutual labels:  logger, logging-library
noodlog
🍜 Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.
Stars: ✭ 42 (+223.08%)
Mutual labels:  logger, logging-library
Woodlot
An all-in-one JSON logging utility that supports ExpressJS HTTP logging, custom logging, provides multi-format output and an easy to use events API.
Stars: ✭ 263 (+1923.08%)
Mutual labels:  logger, logging-library
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+28892.31%)
Mutual labels:  logger, logging-library
Go Logger
Simple logger for Go programs. Allows custom formats for messages.
Stars: ✭ 261 (+1907.69%)
Mutual labels:  logger, logging-library
Izumi
Productivity-oriented collection of lightweight fancy stuff for Scala toolchain
Stars: ✭ 423 (+3153.85%)
Mutual labels:  logger, logging-library
Lighty
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.
Stars: ✭ 49 (+276.92%)
Mutual labels:  logger, logging-library
loggin-js
📝 Customizable and expandable logger for Node.js
Stars: ✭ 20 (+53.85%)
Mutual labels:  logger, logging-library
LogDNA-Android-Client
Android client for LogDNA
Stars: ✭ 22 (+69.23%)
Mutual labels:  logger, logging-library
clue
a extremely high performance log library for android. 高性能的Android日志库
Stars: ✭ 27 (+107.69%)
Mutual labels:  logger, logging-library

Simple-Log C++20 library

Build & Test - MSVC Build & Test - Clang-Cl Build & Test - Clang-10 Build & Test - GCC-10

Codacy Badge

Author

Dominic Koepke
Mail: [email protected]

License

BSL-1.0 (free, open source)

          Copyright Dominic Koepke 2021 - 2021.
 Distributed under the Boost Software License, Version 1.0.
    (See accompanying file LICENSE_1_0.txt or copy at
          https://www.boost.org/LICENSE_1_0.txt)

Description

This is a highly customizable multithreaded logging library, which makes heavy use of loosly coupled concepts rather than macros. Other than many other libraries, there are no singleton classes or forced global objects. It's up to the users if they want globals or not.

If your goal is simply logging everything to console or a file, than you may want to begin with the <ReadyToGo>-header, which will set-up everything you'll need to be able start logging (also look at the short examples at the bottom of this readme). As you'll get used to the library you'll probably want to start customizing the behaviour of your sinks or even exchange types of Record's properties. This library lets you do this. Just head over to docs page https://dnkpp.github.io/Simple-Log/ or have a look at /src/examples directory. If you need an example for some advanced technics, don't hesitate asking me. As this library is growing I'll add more and more (hopefully useful) examples.

A friendly reminder at the end: This library is currently in an alpha state, where it may be possible that some API breaks will happen. If you need a fully stable library from now on, this is unfortunatly not what you're looking for. I'm sorry, but perhaps it will be worth a second look in the near future.

Installation with CMake

This library can easily be integrated into your project via CMake target_link_libraries command.

target_link_libraries(
	<your_target_name>
	PRIVATE
	simple_log
)

This will add the the include path "<simple_log_install_dir>/include", thus you are able to include all headers via

#include <Simple-Log/Simple-Log.hpp>

FetchContent

It is possible fetching this library via CMakes FetchContent module.

cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(<your_project_name>)

include(FetchContent)

FetchContent_Declare(
	simple_log
	GIT_REPOSITORY	https://github.com/DNKpp/Simple-Log
	GIT_TAG		origin/master
)
FetchContent_MakeAvailable(simple_log)

target_link_libraries(
	<your_target_name>
	PRIVATE simple_log
)

Examples

Easy Start

This is an example, which will print every message onto the console. Users will automatically receive a Core instance (gCore), Console Sink (gConsoleSink) and a Logger (gLog).

/* With inclusion of this header, there will be automatically gCore, gConsoleSink and gLog constructed, which you might use.*/
#include <Simple-Log/ReadyToGo.hpp>

// just import everything into the current namespace
using namespace sl::log::ready_to_go;

int main()
{
	// This line will be printed on the console with the severity "info".
	gLog() << "Hello, World!";
	// You may adjust the severity for the currently created Record like so.
	gLog() << SetSev(SevLvl::debug) << "Mighty debug message";
	// The severity manipulator doesn't has to appear at front. Place it anywhere in your Record construction chain.
	gLog() << "Print my important hint!" << SetSev(SevLvl::hint);
}

/*Core will make sure, that all pending Records will be processed before it gets destructed.*/
/*
 * The above code may generate this output:
20:18:59.357 >>> info:: Hello, World!
20:18:59.357 >>> debug:: Mighty debug message
20:18:59.357 >>> hint:: Print my important hint!
 *
 * Keep in mind, you are completely free how you are going to format your message. This is just the default one.
 */

Easy File logging

/* With inclusion of this header, there will be automatically gCore, gConsoleSink and gLog constructed, which you might use.*/
#include <Simple-Log/ReadyToGo.hpp>

// just pull everything into the current namespace
using namespace sl::log::ready_to_go;

// this creates a new FileSink object, which will store all incoming messages in logfile.log
auto& gFileSink = gCore.makeSink<FileSink_t>("logfile.log");

int main()
{
	// Let our FileSink only handle important messages, e.g. warning and above
	gFileSink.setFilter(makeSeverityFilterFor<Record_t>(GreaterEquals{ SevLvl::warning }));

	// this message will only appear on the console
	gLog() << "Hello, World!";

	// while this message will also be saved in our logfile.log. Go ahead and see it yourself ;)
	gLog() << SetSev(SevLvl::warning) << "I'm an exemplary warning!";
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].