Skip to content

Commit ff37f68

Browse files
committed
Remove trace implementation
1 parent 3bbd021 commit ff37f68

File tree

7 files changed

+0
-60
lines changed

7 files changed

+0
-60
lines changed

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,6 @@ else ()
184184
message (FATAL_ERROR "Unknown crypto provider ${MONGOCRYPT_CRYPTO}")
185185
endif ()
186186

187-
set (MONGOCRYPT_ENABLE_TRACE 0)
188-
if (ENABLE_TRACE)
189-
message (WARNING "Building with trace logging. This is highly insecure. Do not use in a production environment")
190-
set (MONGOCRYPT_ENABLE_TRACE 1)
191-
endif ()
192-
193187
set (BUILD_VERSION "0.0.0" CACHE STRING "Library version")
194188
if (BUILD_VERSION STREQUAL "0.0.0")
195189
if (EXISTS ${CMAKE_BINARY_DIR}/VERSION_CURRENT)

bindings/python/pymongocrypt/binding.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ def _parse_version(version):
260260
MONGOCRYPT_LOG_LEVEL_ERROR = 1,
261261
MONGOCRYPT_LOG_LEVEL_WARNING = 2,
262262
MONGOCRYPT_LOG_LEVEL_INFO = 3,
263-
MONGOCRYPT_LOG_LEVEL_TRACE = 4
264263
} mongocrypt_log_level_t;
265264
266265
/**

integrating.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ executable included with libmongocrypt. It uses mock responses from
7272
mongod, mongocryptd, and KMS. Reimplement the state machine loop
7373
(`_run_state_machine`) in example-state-machine with your binding.
7474

75-
To debug, configure with the cmake option `-DENABLE_TRACE=ON`, and set the environment variable `MONGOCRYPT_TRACE=ON` to log the arguments to mongocrypt functions. Note, this is insecure and should only be used for debugging.
76-
7775
Seek help in the slack channel \#drivers-fle.
7876

7977
## Part 2: Integrate into Driver ##

src/mongocrypt-config.h.in

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@
7272
#endif
7373

7474

75-
/*
76-
* MONGOCRYPT_ENABLE_TRACE is set from configure to determine if we are
77-
* compiled with tracing support.
78-
*/
79-
#define MONGOCRYPT_ENABLE_TRACE @MONGOCRYPT_ENABLE_TRACE@
80-
81-
#if MONGOCRYPT_ENABLE_TRACE != 1
82-
# undef MONGOCRYPT_ENABLE_TRACE
83-
#endif
84-
8575
/* clang-format on */
8676

8777
#endif /* MONGOCRYPT_CONFIG_H */

src/mongocrypt-log-private.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ typedef struct {
2424
mongocrypt_mutex_t mutex; /* protects fn and ctx. */
2525
mongocrypt_log_fn_t fn;
2626
void *ctx;
27-
bool trace_enabled;
2827
} _mongocrypt_log_t;
2928

3029
void _mongocrypt_stdout_log_fn(mongocrypt_log_level_t level, const char *message, uint32_t message_len, void *ctx);
@@ -38,42 +37,11 @@ void _mongocrypt_log_cleanup(_mongocrypt_log_t *log);
3837

3938
void _mongocrypt_log_set_fn(_mongocrypt_log_t *log, mongocrypt_log_fn_t fn, void *ctx);
4039

41-
#ifdef MONGOCRYPT_ENABLE_TRACE
42-
43-
#define CRYPT_TRACEF(log, fmt, ...) \
44-
_mongocrypt_log(log, MONGOCRYPT_LOG_LEVEL_TRACE, "(%s:%d) " fmt, BSON_FUNC, __LINE__, __VA_ARGS__)
45-
46-
#define CRYPT_TRACE(log, msg) CRYPT_TRACEF(crypt, "%s", msg)
47-
48-
#define CRYPT_ENTRY(log) _mongocrypt_log(crypt, MONGOCRYPT_LOG_LEVEL_TRACE, "entry (%s:%d)", BSON_FUNC, __LINE__)
49-
50-
#define CRYPT_EXIT(log) \
51-
do { \
52-
_mongocrypt_log(crypt, MONGOCRYPT_LOG_LEVEL_TRACE, "exit (%s:%d)", BSON_FUNC, __LINE__); \
53-
return; \
54-
} while (0)
55-
56-
#define CRYPT_RETURN(log, x) \
57-
do { \
58-
_mongocrypt_log(log, MONGOCRYPT_LOG_LEVEL_TRACE, "return (%s:%d)", BSON_FUNC, __LINE__); \
59-
return (x); \
60-
} while (0)
61-
62-
#define CRYPT_GOTO(log, x) \
63-
do { \
64-
_mongocrypt_log(log, MONGOCRYPT_LOG_LEVEL_TRACE, "goto (%s:%d)", BSON_FUNC, __LINE__); \
65-
goto x; \
66-
} while (0)
67-
68-
#else
69-
7040
#define CRYPT_TRACEF(log, fmt, ...)
7141
#define CRYPT_TRACE(log, msg)
7242
#define CRYPT_ENTRY(log)
7343
#define CRYPT_EXIT(log)
7444
#define CRYPT_RETURN(log, x) return (x);
7545
#define CRYPT_GOTO(log, x) goto x;
7646

77-
#endif /* MONGOCRYPT_ENABLE_TRACE */
78-
7947
#endif /* MONGOCRYPT_LOG_PRIVATE_H */

src/mongocrypt-log.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ void _mongocrypt_log_init(_mongocrypt_log_t *log) {
2626
_mongocrypt_mutex_init(&log->mutex);
2727
/* Initially, no log function is set. */
2828
_mongocrypt_log_set_fn(log, NULL, NULL);
29-
#ifdef MONGOCRYPT_ENABLE_TRACE
30-
log->trace_enabled = (getenv("MONGOCRYPT_TRACE") != NULL);
31-
#endif
3229
}
3330

3431
void _mongocrypt_log_cleanup(_mongocrypt_log_t *log) {
@@ -47,7 +44,6 @@ void _mongocrypt_stdout_log_fn(mongocrypt_log_level_t level, const char *message
4744
case MONGOCRYPT_LOG_LEVEL_ERROR: printf("ERROR"); break;
4845
case MONGOCRYPT_LOG_LEVEL_WARNING: printf("WARNING"); break;
4946
case MONGOCRYPT_LOG_LEVEL_INFO: printf("INFO"); break;
50-
case MONGOCRYPT_LOG_LEVEL_TRACE: printf("TRACE"); break;
5147
default: printf("UNKNOWN"); break;
5248
}
5349
printf(" %s\n", message);
@@ -69,10 +65,6 @@ void _mongocrypt_log(_mongocrypt_log_t *log, mongocrypt_log_level_t level, const
6965
BSON_ASSERT_PARAM(log);
7066
BSON_ASSERT_PARAM(format);
7167

72-
if (level == MONGOCRYPT_LOG_LEVEL_TRACE && !log->trace_enabled) {
73-
return;
74-
}
75-
7668
va_start(args, format);
7769
message = bson_strdupv_printf(format, args);
7870
va_end(args);

src/mongocrypt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ typedef enum {
255255
MONGOCRYPT_LOG_LEVEL_ERROR = 1,
256256
MONGOCRYPT_LOG_LEVEL_WARNING = 2,
257257
MONGOCRYPT_LOG_LEVEL_INFO = 3,
258-
MONGOCRYPT_LOG_LEVEL_TRACE = 4
259258
} mongocrypt_log_level_t;
260259

261260
/**

0 commit comments

Comments
 (0)