Kamakazi
The C++ log library
What is it and why?
Kamakazi is a library for C++ allowing the use of logs in a simpler and more intuitive way.
Kamakazi exists as a way to easily create logs for your programs and return them through the terminal to be read through stdout.
It is also good for error handling as Kamakazi will end the program before any major issues arise using its "dangerLevel" system from 0-10 (0 being: minor issue just ignore, and 10 being: massive issue end program immediately)
How to install?
You can install Kamakazi on your Linux system using bash scripts by running the following commands:
# --- clone the git repository ---
git clone https://github.com/Ametrine-cc/Kamakazi.git
# --- cd into the directory ---
cd Kamakazi
cd src
# --- run the install.sh command to install Kamakazi ---
chmod +x install.sh
./install.sh
# --- To uninstall run the uninstall.sh command instead ---
chmod +x uninstall.sh
./uninstall.shAlternatively you can compile Kamakazi with commands manually (ps: the install.sh script already does this for you)
# --- clone the git repository ---
git clone https://github.com/Ametrine-cc/Kamakazi.git
# --- cd into the directory ---
cd Kamakazi
# --- run the build commands to install Kamakazi ---
cmake -B build
cmake --build build
# --- run as superuser so all files can be moved and build accordingly ---
sudo cmake --install buildUnintsallation:
# --- To uninstall run the uninstall commands as superuser instead ---
sudo rm -rf /usr/local/include/kamakazi
sudo rm -rf /usr/local/lib/libKamakaziLib.aUpdates to Kamakazi?
Kamakazi doesn't have an update feature implemented as it is purely a C++ library, however when updates occur it will be posted to all Ametrine Foundation social media, and to the website. So you will be able to easily find out if an update has happend adding functionality or bug fixes.
To update Kamakazi, run the installation part of the documentation again and Kamakazi will update to the latest version (Repository must be re-cloned from the github first) or run update.sh to update Kamakazi.
Update using update.sh:
# --- cd back into Kamakazi directory you already had from original installation or from re-cloning the repository ---
cd Kamakazi
# --- run the updater ---
chmod +x update.sh
./update.shUpdate manually:
# --- cd back into Kamakazi directory from re-cloning the repository ---
git clone https://github.com/Ametrine-cc/Kamakazi.git
cd Kamakazi/src
# --- rebuild and install Kamakazi ---
cmake -B build
cmake --build build
sudo cmake --install buildUsing Kamakazi:
All examples for using Kamakazi in production are foind in the examples/ directory in this repository.
When using Kamakazi, the library must be linked during compilation. You can do this in two ways,
In g++:
# --- Include the KamakaziLib for compilation ---
g++ src/PROJECT_NAME -lKamakaziLib -o PROJECT_NAMEIn cmake:
# --- Dependencies ---
find_library(KAMAKAZI_PATH NAMES KamakaziLib)
# --- Check if it was actually found ---
if(NOT KAMAKAZI_PATH)
message(FATAL_ERROR "KamakaziLib not found! Did you run 'sudo cmake --install'?")
endif()
target_link_libraries(PROJECT_NAME PRIVATE ${KAMAKAZI_PATH})Replace "PROJECT_NAME" with your project name and all code presented is drag and droppable.
Examples:
More examples can be found in "examples/"
Example of Kamakazi syntax
Example no major issues:
#include <kamakazi>
// Required: Set global values, can be changes later on
bool Kamakazi_Utils::should_log = true;
bool Kamakazi_Utils::ignore_dangerLevel = false;
bool Kamakazi_Utils::show_dangerLevel = true;
// Main loop
int main() {
// Call Kamakazi: Normal log : Show Kamakazi version
kazi_log(__FUNCTION__, kamakazi_version);
// Call Kamakazi: Major error
// dangerLevel set at 0, exits program quietly as not major issue
kamakazi("NO_WALLPAPER", 0);
return 0;
}
// Output
// [main] Hello from Kamakazi!
// [main] Kamakazi Version 1.0.0
// [ERROR : 0] | NO_WALLPAPERExample with major issue:
#include <kamakazi>
// Required: Set global values, can be changes later on
bool Kamakazi_Utils::should_log = true;
bool Kamakazi_Utils::ignore_dangerLevel = false;
bool Kamakazi_Utils::show_dangerLevel = true;
// Main loop
int main() {
// Call Kamakazi: Normal log : Show Kamakazi version
kazi_log(__FUNCTION__, kamakazi_version);
// Call Kamakazi: Major error
// dangerLevel set at 10, immediately exits program to prevent further issues
kamakazi("NO_FILESYSTEM", 10);
return 0;
}
// Output
// [main] Hello from Kamakazi!
// [main] Kamakazi Version 1.0.0
// [ERROR : 10] | NO_FILESYSTEMIf danger level above or equal to 10, program crashes for saftey but if danger level is 0 close quietly. Between that the program still outputs the errors to the terminal but doesnt close.
How to contribute?
We welcome contributions from the community to help improve Kamakazi! Whether it's reporting bugs, suggesting new features, or submitting code changes, your help is valuable.
Reporting Bugs:
If you find a bug, please help us by reporting it on the GitHub Issues page. When reporting a bug, please include:
- A clear and concise description of the bug.
- Steps to reproduce the behavior.
- Expected behavior vs. actual behavior.
- Any error messages or logs.
- Your operating system and compiler version.
Suggesting Enhancements and Features:
Do you have an idea for a new feature or an improvement to an existing one? We'd love to hear about it! Please open an issue on the GitHub Issues page and:
- Clearly describe the proposed feature or enhancement.
- Explain the problem it solves or the use case it addresses.
- (Optional) Provide any thoughts on how it might be implemented.
Anything else about Kamakazi such as discussions, can be talked about on our Matrix (temp) channel.
Thank you for helping to make Kamakazi better!
Credits:
- Lead Developer - Noticxs
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.