BitLab 0.1.0
BitLab: A Browser for the Bitcoin P2P Network and Blockchain
|
#include "log.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "utils.h"
Go to the source code of this file.
Functions | |
const char * | create_logs_dir () |
Create logs directory used to create the logs directory if it does not exist. | |
void | init_logging (const char *filename) |
Initialize logging used to initialize the logging system, open and preserve the log file. | |
void | log_message (log_level level, const char *filename, const char *source_file, const char *format,...) |
Log a message used to log a message to the console or a file. | |
void | finish_logging () |
Finish logging used to finish logging and close the log file. | |
Variables | |
static struct loggers | logs = { PTHREAD_MUTEX_INITIALIZER, {NULL}, 0 } |
static const char * | logs_dir = NULL |
const char * create_logs_dir | ( | ) |
Create logs directory used to create the logs directory if it does not exist.
Definition at line 20 of file log.c.
References logs_dir.
Referenced by init_logging(), and log_message().
void finish_logging | ( | ) |
Finish logging used to finish logging and close the log file.
Definition at line 199 of file log.c.
References loggers::array, logger::file, logger::filename, loggers::is_initializing, loggers::log_mutex, logs, logs_dir, MAX_LOG_FILES, and usleep().
Referenced by run_bitlab().
void init_logging | ( | const char * | filename | ) |
Initialize logging used to initialize the logging system, open and preserve the log file.
log_file | The log file to write to. |
Definition at line 34 of file log.c.
References loggers::array, BUFFER_SIZE, create_logs_dir(), logger::file, logger::filename, loggers::is_initializing, loggers::log_mutex, logs, logs_dir, and MAX_LOG_FILES.
Referenced by connect_to_peer(), and run_bitlab().
void log_message | ( | log_level | level, |
const char * | filename, | ||
const char * | source_file, | ||
const char * | format, | ||
... | |||
) |
Log a message used to log a message to the console or a file.
level | The log level. |
log_file | The file that the log message is destined for. |
source_file | The source file that the log message is from. |
format | The format of the log message. |
... | The arguments for the format. |
Definition at line 89 of file log.c.
References loggers::array, BUFFER_SIZE, create_logs_dir(), logger::file, logger::filename, fileno(), get_formatted_timestamp(), LOCKED_FILE_RETRY_TIME, LOCKED_FILE_TIMEOUT, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, loggers::log_mutex, LOG_WARN, logs, logs_dir, MAX_LOG_FILES, TIMESTAMP_LENGTH, and usleep().
Referenced by add_peer_to_queue(), build_inv_message(), cli_clear(), cli_connect(), cli_disconnect(), cli_echo(), cli_exec_line(), cli_exit(), cli_getaddr(), cli_getblocks(), cli_getdata(), cli_getheaders(), cli_help(), cli_history(), cli_info(), cli_inv(), cli_list(), cli_peer_discovery(), cli_ping(), cli_tx(), cli_whoami(), connect_to_peer(), disconnect(), force_stop_peer_discovery(), handle_cli(), handle_inv_message(), handle_peer_discovery(), init_program_state(), is_in_private_network(), is_valid_domain_address(), lookup_address(), peer_communication(), run_bitlab(), send_addr(), send_getaddr_and_wait(), send_getblocks_and_wait(), send_getdata_and_wait(), send_getheaders_and_wait(), send_headers(), send_inv_and_wait(), send_ping(), send_tx(), send_verack(), set_peer_discovery(), set_peer_discovery_dns_domain(), start_peer_discovery_progress(), thread_runner(), and write_var_int().
|
static |
Definition at line 16 of file log.c.
Referenced by finish_logging(), init_logging(), and log_message().
|
static |
Definition at line 18 of file log.c.
Referenced by create_history_dir(), create_logs_dir(), finish_logging(), init_logging(), and log_message().