|
1 | 1 | #include "log_file_util.h" |
2 | | -#include <snowflake/logger.h> |
| 2 | +#include "../logger/SFLogger.hpp" |
3 | 3 | #ifndef _WIN32 |
4 | 4 | #include <errno.h> |
5 | 5 | #include <sys/stat.h> |
6 | 6 | #endif |
7 | 7 |
|
| 8 | +using namespace Snowflake::Client; |
| 9 | +extern "C" { |
| 10 | + |
8 | 11 | void log_warn_when_accessible_by_others(const char *filePath, const char *context, sf_bool log_read_access) |
9 | 12 | { |
10 | 13 | #ifndef _WIN32 |
11 | 14 | struct stat ret; |
12 | 15 | if (stat(filePath, &ret) == 0) |
13 | 16 | { |
14 | | - log_debug("%s File %s access rights %o", context, filePath, ret.st_mode); |
| 17 | + CXX_LOG_DEBUG("%s File %s access rights %o", context, filePath, ret.st_mode); |
15 | 18 | if (log_read_access && |
16 | 19 | (ret.st_mode & S_IRGRP || ret.st_mode & S_IROTH)) |
17 | 20 | { |
18 | | - log_warn("%s File %s is accessible by others with permissions %o", |
| 21 | + CXX_LOG_WARN("%s File %s is accessible by others with permissions %o", |
19 | 22 | context, filePath, ret.st_mode); |
20 | 23 | } |
21 | 24 | } |
22 | 25 | else |
23 | 26 | { |
24 | | - log_warn("%s, Unable to access the file to check the permission: %s. Error %d", |
| 27 | + CXX_LOG_WARN("%s, Unable to access the file to check the permission: %s. Error %d", |
25 | 28 | context, filePath, errno); |
26 | 29 | } |
27 | 30 | #endif |
28 | 31 | } |
29 | 32 |
|
30 | 33 | void log_file_usage(const char* filePath, const char* context, sf_bool log_read_access) |
31 | 34 | { |
32 | | - log_info("%s Accessing file: %s", context, filePath); |
| 35 | + CXX_LOG_INFO("%s Accessing file: %s", context, filePath); |
33 | 36 | log_warn_when_accessible_by_others(filePath, context, log_read_access); |
34 | 37 | } |
| 38 | + |
| 39 | +} // extern "C" |
0 commit comments