https://github.com/thecompez/elogger
eLogger is a modern cross-platform logger
https://github.com/thecompez/elogger
cpp20 cross-platform event-logger logger
Last synced: 11 months ago
JSON representation
eLogger is a modern cross-platform logger
- Host: GitHub
- URL: https://github.com/thecompez/elogger
- Owner: TheCompez
- License: mit
- Created: 2020-10-31T20:56:49.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-28T07:57:46.000Z (over 4 years ago)
- Last Synced: 2024-11-19T20:53:02.500Z (over 1 year ago)
- Topics: cpp20, cross-platform, event-logger, logger
- Language: C++
- Homepage:
- Size: 358 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eLogger
eLogger is a modern efficient **cross-platform** logger
**Note :** This library is not yet complete and conceptually under development.
[](https://forthebadge.com)
[](https://lgtm.com/projects/g/Kambiz-Asadzadeh/RestService/alerts/)
[](https://lgtm.com/projects/g/Kambiz-Asadzadeh/RestService/context:cpp)



**Platform Support**
- [x] Windows
- [x] macOS
- [x] Linux
- [ ] FreeBSD (Under Development)
- [ ] Android (Under Development)
- [ ] iOS (Under Development)
## Installation
Just add into your project :) And go on!
## Building
- You need CMake tool for building source code
- All source code is written with Pure STL 1z (C++17)
- MSVC 2017, GCC8.x or Clang 9.x
- Add eLogger.dll [on Windows], libeLogger.dylib [on macOS] or libeLogger.so [on Linux] for your project as external library. you can compile it by static mode.
- Import SDK common header ```#include ```
**Note:** In order to build the create, your compiler must support C++17 features.
**Building extra option in CMake**
```
cmake .. -DENABLE_SAFE_ONLY=true
cmake .. -DENABLE_SAFTY_MODE=true
```
## Usage Example
- You can set logger state by building tools variable such as CMake or QMake by ```ELOGGER_BUILD_DEBUG_MODE``` variable.
```
CMAKE:
set(ELOGGER_BUILD_DEBUG_MODE true)
QMAKE:
DEFINES += ELOGGER_BUILD_DEBUG_MODE
```
- Or you can set this option as c++ boolean type
```cpp
DeveloperMode::IsEnable = true; //false means you can't print any logs.
```
- You can specify the settings of log level:
```cpp
eLogger::Logger::LoggerModel = eLogger::Mode::User;
```
- And then, you can check developer mode if it was enable!
```cpp
if(isset(DeveloperMode::IsEnable)) {
eLogger::Log("Info Message : " , LoggerType::Info);
eLogger::Log("Default Message : " , LoggerType::Default);
eLogger::Log("Warning Message : " , LoggerType::Warning);
eLogger::Log("Paused Message : " , LoggerType::Paused);
eLogger::Log("Success Message : " , LoggerType::Success);
eLogger::Log("Progress Message : " , LoggerType::InProgress);
eLogger::Log("Failed Message : " , LoggerType::Failed);
eLogger::Log("Done Message : " , LoggerType::Done);
}
```
## Full Example of usage
```cpp
#include
#include
using namespace std;
using namespace eLogger;
int main()
{
Core::init();
DeveloperMode::IsEnable = {true};
Logger::LoggerModel = Mode::Developer;
if(isset(DeveloperMode::IsEnable)) {
Log("Info Message : " , LoggerType::Info);
Log("Default Message : " , LoggerType::Default);
Log("Warning Message : " , LoggerType::Warning);
Log("Paused Message : " , LoggerType::Paused);
Log("Success Message : " , LoggerType::Success);
Log("Progress Message : " , LoggerType::InProgress);
Log("Failed Message : " , LoggerType::Failed);
Log("Done Message : " , LoggerType::Done);
}
return 0;
}
```
## Output as User mode:
```
eLogger 0.5 - compiled on Nov 6 2020
Release mode: alpha - 2
Host machine init:
Operation System: macOS
Language Standard: ISO/IEC 14882:2017
Compiler Type: Clang/LLVM:12.0.0 (clang-1200.0.32.6)
=> Log Id : [0] : [Info] Info Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [1] : [Default] Default Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [2] : [Warning] Warning Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [3] : [Paused] Paused Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [4] : [Success] Success Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [5] : [InProgress] Progress Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [6] : [Failed] Failed Message : { DateTime: 2020/11/01 01:48:19 }
=> Log Id : [7] : [Done] Done Message : { DateTime: 2020/11/01 01:48:19 }
```
## Output as Developer mode:
```
eLogger 0.5 - compiled on Nov 6 2020
Release mode: alpha - 2
Host machine init:
Operation System: macOS
Language Standard: ISO/IEC 14882:2017
Compiler Type: Clang/LLVM:12.0.0 (clang-1200.0.32.6)
=> Log Id : [0][ Line : 16] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Info] Info Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [1][ Line : 17] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Default] Default Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [2][ Line : 18] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Warning] Warning Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [3][ Line : 19] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Paused] Paused Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [4][ Line : 20] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Success] Success Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [5][ Line : 21] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [InProgress] Progress Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [6][ Line : 22] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Failed] Failed Message : { DateTime: 2020/11/06 18:50:48 }
=> Log Id : [7][ Line : 23] [ Function : main] [ Thread Id : 0x11546bdc0] [ File : ../TestLogger/main.cpp] ] : [Done] Done Message : { DateTime: 2020/11/06 18:50:48 }
```
## Contribution
Bug fixes, docs, and enhancements welcome! Please let me know kambiz.ceo@gmail.com
**Screen Shots**


## **ToDo**
* And more features...