Skip to content

Mir-log/Mirloghpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Mirloghpp

A lightweight single-header logger for small C++ projects. C++11

#include "mirror.h"

Example:

#include "mirror.h"

int main() {
    Mirror_Fast();  // optional: speed up I/O

    mirror::mirprint(mirror::Lv::Info,  "Server started",    mirror::Mode::coloredstr);
    mirror::mirprint(mirror::Lv::Warn,  "High memory usage", mirror::Mode::coloredstr);
    mirror::mirprint(mirror::Lv::Error, "Connection lost",   mirror::Mode::coloredstr);

    // Custom color
    mirror::mirprint(mirror::Lv::Info, "Special message", 
                     mirror::Mode::coloredstr, mirror::Colors::blue);

    return 0;
}

Output:

2025-04-11 12:34:56 UTC [INFO] Server started      
2025-04-11 12:34:56 UTC [WARN] High memory usage   
2025-04-11 12:34:56 UTC [ERROR] Connection lost    
2025-04-11 12:34:56 UTC [INFO] Special message     

On Windows, the library automatically enables virtual terminal processing to support ANSI escape codes in the console.

API Reference

I/O Optimization Macro

Mirror_Fast()

Disables synchronization between C++ and C standard streams, and unties std::cin from std::cout.
Call once at the beginning of main() to speed up console I/O.

About

A lightweight single-header logger for small C++ projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages