Giter VIP home page Giter VIP logo

loggy's Introduction

Loggy: Header-Only C++ Logging Library

Loggy is a lightweight, header-only C++ logging library. It supports multithreaded environments and includes color coding for enhanced readability.

An example of the console window with logs in it

Features

  • Header-only: No need for additional compilation steps or external dependencies.
  • Multithreaded: Designed to work seamlessly in multithreaded applications.
  • Color Coding: Log messages are color-coded for different log levels, aiding quick identification.
  • Customizable: Easily configure log levels, timestamp formats, source information formats, and log message formats.

Getting Started

Prerequisites

  • C++11 or later compiler

Build project

mkdir build & cd build
cmake ..

Usage

First you'll have to include loggy.h into your project:

#include <loggy.h>

A full example can be found in the example.cpp file.

Set the default log level:

LOGGY_SET_DEFAULT_LOG_LEVEL(LogLevel::DEBUG);

Set the timestamp format (See conversion specifiers):

LOGGY_SET_TIMESTAMP_FORMAT("%Y-%m-%d %H:%M:%S");

Set the source info:

LOGGY_SET_SOURCE_INFO_FORMAT("%f:%l");
Specifier Explanation
f The file path of where the log is being executed
l The line in the file where the log is being executed

Set the log format:

LOGGY_SET_LOG_FORMAT("%t [%l] %s: %m");
Specifier Explanation
t The timestamp
l The log level
s The source information
m The log message

Logging using the default log level:

LOGGY_LOG("DEFAULT LEVEL");

Logging using a custom log level:

LOGGY_LOG("FATAL", LogLevel::FATAL);

loggy's People

Contributors

jaimievos avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.