2022-12-04 18:54:57 +01:00
|
|
|
/*
|
|
|
|
This is part of WHY2
|
|
|
|
Copyright (C) 2022 Václav Šmejkal
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-11-18 19:10:03 +01:00
|
|
|
#ifndef WHY2_LOGGER_FLAGS_H
|
|
|
|
#define WHY2_LOGGER_FLAGS_H
|
|
|
|
|
2022-11-18 19:15:52 +01:00
|
|
|
//CONSTS
|
2023-02-05 18:15:33 +01:00
|
|
|
enum WHY2_LOGGER_EXIT_CODES //exit codes you fucking idiot (2#)
|
2022-11-18 19:46:57 +01:00
|
|
|
{
|
|
|
|
INVALID_FILE = -1 //THIS WILL HAPPEN IF YOU USE TOO MUCH LOGS lol
|
|
|
|
};
|
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_WRITE_MESSAGE_1 "Hello from logger-test! 👋"
|
|
|
|
#define WHY2_WRITE_MESSAGE_2 "aAzZ( )!?#\\/śŠ <3|420*;㍿㊓ㅅΔ♛👶🏿"
|
|
|
|
#define WHY2_WRITE_MESSAGE_3 "ˢᵃʸ ʸᵉˢ ᵗᵒ ᵈʳᵘᵍˢ"
|
2023-01-25 12:19:53 +01:00
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_WRITE_DIR "./logs"
|
|
|
|
#define WHY2_LOG_LATEST "latest.log"
|
2022-11-22 18:55:34 +01:00
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_LOG_FORMAT "yyyy-mm-dd_xxx.log" //THE LAST xxx IS FOR BASE-16 NUMBER OF USAGE THAT DAY (SO MAX IS 4095 [FFF] USAGES PER DAY)
|
|
|
|
#define WHY2_LOG_FORMAT_START "yyyy-mm-dd" //FIRST PART OF WHY2_LOG_FORMAT
|
2022-11-23 19:48:59 +01:00
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_LOG_FORMATTING "%s/%s_%03x.log" //SAME THING AS WHY2_LOG_FORMAT, BUT USED IN sprintf IN logger.c, NOT AS LENGTH
|
|
|
|
#define WHY2_LOG_FORMATTING_START "%04d-%02d-%02d" //FIRST PART OF WHY2_LOG_FORMATTING
|
2022-11-22 18:35:46 +01:00
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_WRITE_FORMAT "[hh:mm:ss]: " //LOG MESSAGE'S PREFIX (THE SPACE AT THE END IS INTENTIONAL)
|
|
|
|
#define WHY2_WRITE_FORMATTING "[%02d:%02d:%02d]: %s\n" //guess what
|
2022-11-22 18:35:46 +01:00
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_LOG_LATEST_FORMATTING "%s/%s"
|
2022-12-09 15:10:41 +01:00
|
|
|
|
2023-01-29 20:14:11 +01:00
|
|
|
#define WHY2_MAX_USAGE 0xfff //LOOK AT WHY2_LOG_FORMAT
|
2022-11-18 19:10:03 +01:00
|
|
|
|
2022-12-04 19:04:24 +01:00
|
|
|
//TYPES
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int file;
|
2023-02-03 17:03:46 +01:00
|
|
|
char *filename;
|
2023-01-29 20:14:11 +01:00
|
|
|
} why2_log_file;
|
2022-12-04 19:04:24 +01:00
|
|
|
|
2022-12-09 17:28:48 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *key;
|
2023-01-29 20:14:11 +01:00
|
|
|
} why2_log_flags;
|
2022-12-09 17:28:48 +01:00
|
|
|
|
2023-01-25 13:45:37 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2023-02-03 17:03:46 +01:00
|
|
|
char **decrypted_text;
|
2023-01-25 13:45:37 +01:00
|
|
|
unsigned long length;
|
2023-01-29 20:14:11 +01:00
|
|
|
} why2_decrypted_output;
|
2023-01-25 13:45:37 +01:00
|
|
|
|
2022-12-09 17:35:21 +01:00
|
|
|
//GETTERS
|
2023-01-29 20:14:11 +01:00
|
|
|
why2_log_flags why2_get_log_flags(void);
|
2022-12-09 17:35:21 +01:00
|
|
|
|
|
|
|
//SETTERS
|
2023-01-29 20:14:11 +01:00
|
|
|
void why2_set_log_flags(why2_log_flags why2_log_flagsNew);
|
2022-12-09 17:35:21 +01:00
|
|
|
|
2022-11-18 19:10:03 +01:00
|
|
|
#endif
|