An open API service indexing awesome lists of open source software.

https://github.com/zarox28/logger-cpp

Simple logging library in C++
https://github.com/zarox28/logger-cpp

cpp logging

Last synced: about 1 year ago
JSON representation

Simple logging library in C++

Awesome Lists containing this project

README

          

# Logger

![C++](https://img.shields.io/badge/c++-%2300599C.svg?style=for-the-badge&logo=c%2B%2B&logoColor=white)
![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg?style=for-the-badge)

> Version: **1.2.0**

---

## Table of Contents

- [About](#about)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Init](#init)
- [Reset](#reset)
- [Debug](#debug)
- [Info](#info)
- [Success](#success)
- [Warning](#warning)
- [Error](#error)
- [Fatal](#fatal)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [License](#license)
- [Authors](#authors)

## About

This is a simple `C++` logger that can be used to log messages to the console or to a file.

## Features

- Debug, Info, Warning, Error and Fatal log levels

## Installation

1. Add the `Logger` submodule to your project

```bash
git submodule add https://github.com/Zarox28/Logger.git libs/Logger
```

2. Initialize the submodule & update it

```bash
git submodule update --init --recursive
```

3. Include the `Logger` header file in your project

```cpp
#include "libs/Logger/Logger.h"
```

> **Note:** The `Logger` submodule is located in the `libs` directory of your project.

> **Tip:** You can also add `using namespace Logger;` to your project to avoid having to type `Logger::` before every log level.

## Usage

### Init

```cpp
Logger::init();
```

### Reset

```cpp
Logger::reset();
```

### Debug

```cpp
Logger::debug("This is a debug message");
```

Preview

![](assets/debug.webp)

### Info

```cpp
Logger::info("This is an info message");
```

Preview

![](assets/info.webp)

### Success

```cpp
Logger::success("This is a success message");
```

Preview

![](assets/success.webp)

### Warn

```cpp
Logger::warn("This is a warning message");
```

Preview

![](assets/warn.webp)

### Error

```cpp
Logger::error("This is an error message");
```

Preview

![](assets/error.webp)

### Fatal

```cpp
Logger::fatal("This is a fatal message");
```

Preview

![](assets/fatal.webp)

> **Note:** Fatal log message blink in red to catch the user's attention.

## Changelog

see [CHANGELOG.md](CHANGELOG.md) for latest changes.

## Contributing

Contributing is disabled for this repository.

## License

This project is licensed under the AGPL v3 License - see the [LICENSE](LICENSE.md) file for details.

## Authors

- **[@Zarox28](https://github.com/Zarox28)**