Logging Library is a lightweight, open-source logging utility designed to eliminate the complexity.
- Enhanced Readability: I found default method hard so made this more easy to read
logging(LOG_INFO, "test");or use systemlog to log system infosystemlog(LOG_SYSTEM);. - Reduced Complexity: Avoid jargon and use clear, direct words to ensure understanding.
- Lightweight Design: Focuses only on essential logging without unnecessary bloat.
- Open Source: Fully transparent and community-driven under the BSD-3-Clause license.
To integrate Stylelibrary into your project, use the following installation command:
# Example installation (Keep you git install)
git clone https://github.com/transcrimee/Logging-Library.git// Example usage of the logging library
#include <stdio.h>
#include "logging.h"
int main() {
int age; // Declare an integer variable to store the age
// Prompt the user for input
printf("Enter your age: ");
// Read the integer input from the user and store it in the 'age' variable
scanf("%d", &age);
// Use an if statement to check the condition
if (age >= 18) {
printf("You are eligible to vote.\\n");
logging(LOG_INFO, "User is eligible to vote.");
} else {
printf("You are not eligible to vote yet.\\n");
logging(LOG_INFO, "User is not eligible to vote.");
}
return 0;
}// Example usage of systemlog to log system information
#include <stdio.h>
#include <string.h> // Required for strcmp()
#include "logging.h"
int main() {
char answer[10]; // Buffer to store the input (e.g., 10 characters)
printf("Do want log your system Enter 'yes' or 'no': ");
scanf("%s", answer); // Read the string
// strcmp returns 0 if the strings are identical
if (strcmp(answer, "yes") == 0) {
printf("You entered yes. your has been log\n");
systemlog(LOG_SYSTEM);
} else if (strcmp(answer, "no") == 0) {
printf("You entered no.\n"):
} else {
printf("Invalid input.\n");
}
return