https://github.com/j-city/somelogger
Simpe logger for c++ and python
https://github.com/j-city/somelogger
Last synced: over 1 year ago
JSON representation
Simpe logger for c++ and python
- Host: GitHub
- URL: https://github.com/j-city/somelogger
- Owner: J-CITY
- License: mit
- Created: 2019-05-17T09:47:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-01T08:46:37.000Z (over 1 year ago)
- Last Synced: 2025-03-01T09:26:33.894Z (over 1 year ago)
- Language: C++
- Size: 578 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple logger for `C++` and `Python`
Also it support tables and lists for more beautiful output
## Usage in `C++`
```c++
#include
#include "SomeLogger.h"
using namespace std;
using namespace SomeLogger;
int main() {
Logger logger = Logger::Instance();
// PRINT_LINE and PRINT_LINE_STR - define for print code line
// stream
logger.log(LoggerLevel::ERR, Color::Red, Color::Blue) <<
PRINT_LINE_STR << " TEST" << Endl();
// format output
logger.log(LoggerLevel::ERR, Color::Red, Color::Blue)
.logFormat("Data: %d - %d", 42, PRINT_LINE).endl();
// print containers
std::map m = {
{"one", 1},
{"two", 2},
{"three", 3},
};
std::vector v = { 0,1,2 };
logger << m << Endl();
logger << v << Endl();
// print list
List l;
l << "TEST";
l << "TEST";
l << "TEST";
l << "TEST";
l << "TEST";
l.print();
//or
logger << l << Endl();
// print table
Table t(5, 5);
t.insert(1, 1, "!!!!");
t.insert(1, 2, "!!!!");
t.insert(1, 3, "!!!!");
t.insert(4, 4, "!!!!");
t[2][4] = TableElem("QWQFS");
t.print();
// or
logger << t << Endl();
return 0;
}
```
## Usage in `Python`
```python
l=Logger()
l.log(Level.ERROR).lprint("TEST")
# print list
l = List()
l.insert(List.ElemList("TEST"))
l.insert(List.ElemList("TEST"))
l.insert(List.ElemList("TEST"))
l.insert(List.ElemList("TEST"))
l.insert(List.ElemList("TEST"))
l.lprint()
# print table
t = Table(5, 3)
t.insert(1, 1, "!!!!")
t.insert(2, 1, "!!!fsdf!")
t.insert(0, 1, "!22!")
t.insert(0, 0, "!")
t.tprint()
```