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

Add Logger_Exit to match current NewLogger_* functions #31

Open
yanis-fourel opened this issue Nov 29, 2021 · 1 comment
Open

Add Logger_Exit to match current NewLogger_* functions #31

yanis-fourel opened this issue Nov 29, 2021 · 1 comment

Comments

@yanis-fourel
Copy link
Collaborator

These NewLogger_* functions do not have a clear matching function to delete created logger.
Solution:

  • (opt) Rename these functions Logger_New_*
  • Add Logger_Delete wrapper to current Logger_Exit
//! Returns a logger for STDOUT. Should not be present twice per `t_atapi`.
s_logger		NewLogger_StdOut(
	t_bool			log_timestamp,
	t_bool			log_verbose,
	t_bool			log_obfuscated,
	e_logformat		log_format
);

//! Returns a logger for STDERR. Should not be present twice per `t_atapi`.
s_logger		NewLogger_StdErr(
	t_bool			log_timestamp,
	t_bool			log_verbose,
	t_bool			log_obfuscated,
	e_logformat		log_format
);

//! Create a new logger object from the specified settings
e_exception		NewLogger(s_logger *a_result,
	char const*		log_path,
	t_bool			log_silence_logs,
	t_bool			log_silence_errors,
	t_bool			log_timestamp,
	t_bool			log_verbose,
	t_bool			log_obfuscated,
	t_bool			log_append,
	e_logformat		log_format
);
@Fulguritude
Copy link
Collaborator

The NewLogger functions are found in the AvesTerra source folder.
I would actually have the following behavior:

  • Logger_New: construct a logger struct and open its fd

  • Logger_Init: open an fd for a giver logger struct

  • Logger_Duplicate: duplicate a logger struct, with the same fd

  • Logger_Delete: release fd, free memory

  • Logger_Exit: release fd, do not free memory (path)

  • Logger_Delete_Memory: do not release fd, but free memory (useful when duplicating)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants