Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/log extension #192

Merged
merged 3 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Debug
build
test_save_config.cfg
.idea
.DS_Store
4 changes: 4 additions & 0 deletions src/commons/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ t_log* log_create(char* file, char *program_name, bool is_active_console, t_log_
FILE *file_opened = NULL;

if (file != NULL) {
if (!string_ends_with(file, ".log")) {
error_show("Log file must have .log extension");
return NULL;
}
file_opened = txt_open_for_append(file);

if (file_opened == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/commons/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/**
* @brief Crea una instancia de logger
*
* @param file: La ruta hacia el archivo donde se van a generar los logs
* @param file: La ruta hacia el archivo donde se van a generar los logs, debe tener extensión `.log`
* @param process_name: El nombre a ser mostrado en los logs
* @param is_active_console: Si lo que se loguea debe mostrarse por consola
* @param level: El nivel de detalle máximo a loguear (ver definición de t_log_level)
Expand Down