Skip to content

Commit bbbdbac

Browse files
committed
Run clang-format
1 parent 7d4e9f5 commit bbbdbac

File tree

5 files changed

+107
-81
lines changed

5 files changed

+107
-81
lines changed

src/libmongoc/src/mongoc/mongoc-client.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,7 +2325,8 @@ _mongoc_client_monitor_op_killcursors (mongoc_cluster_t *cluster,
23252325
_mongoc_client_prepare_killcursors_command (cursor_id, collection, &doc);
23262326

23272327
// @todo Provide missing arguments
2328-
mongoc_structured_log_command_started (&doc, "killCursors", db, operation_id, cluster->request_id, 0, 0, false);
2328+
mongoc_structured_log_command_started (
2329+
&doc, "killCursors", db, operation_id, cluster->request_id, 0, 0, false);
23292330

23302331
if (!client->apm_callbacks.started) {
23312332
bson_destroy (&doc);
@@ -2375,15 +2376,14 @@ _mongoc_client_monitor_op_killcursors_succeeded (
23752376
bson_append_array_end (&doc, &cursors_unknown);
23762377

23772378
// @todo Provide missing arguments
2378-
mongoc_structured_log_command_success (
2379-
"killCursors",
2380-
operation_id,
2381-
&doc,
2382-
duration,
2383-
cluster->request_id,
2384-
0,
2385-
0,
2386-
false);
2379+
mongoc_structured_log_command_success ("killCursors",
2380+
operation_id,
2381+
&doc,
2382+
duration,
2383+
cluster->request_id,
2384+
0,
2385+
0,
2386+
false);
23872387

23882388
if (!client->apm_callbacks.succeeded) {
23892389
bson_destroy (&doc);
@@ -2428,15 +2428,14 @@ _mongoc_client_monitor_op_killcursors_failed (
24282428
bson_append_int32 (&doc, "ok", 2, 0);
24292429

24302430
// @todo Provide missing arguments
2431-
mongoc_structured_log_command_failure (
2432-
"killCursors",
2433-
operation_id,
2434-
&doc,
2435-
error,
2436-
cluster->request_id,
2437-
0,
2438-
0,
2439-
false);
2431+
mongoc_structured_log_command_failure ("killCursors",
2432+
operation_id,
2433+
&doc,
2434+
error,
2435+
cluster->request_id,
2436+
0,
2437+
0,
2438+
false);
24402439

24412440
if (!client->apm_callbacks.failed) {
24422441
bson_destroy (&doc);

src/libmongoc/src/mongoc/mongoc-cluster.c

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,14 @@ mongoc_cluster_run_command_monitored (mongoc_cluster_t *cluster,
534534
}
535535

536536
// @todo Provide missing arguments
537-
mongoc_structured_log_command_started (cmd->command, cmd->command_name, cmd->db_name, cmd->operation_id, request_id, 0, 0, false);
537+
mongoc_structured_log_command_started (cmd->command,
538+
cmd->command_name,
539+
cmd->db_name,
540+
cmd->operation_id,
541+
request_id,
542+
0,
543+
0,
544+
false);
538545

539546
if (callbacks->started) {
540547
mongoc_apm_command_started_init_with_cmd (
@@ -565,7 +572,7 @@ mongoc_cluster_run_command_monitored (mongoc_cluster_t *cluster,
565572

566573
if (retval) {
567574
bson_t fake_reply = BSON_INITIALIZER;
568-
int64_t duration = bson_get_monotonic_time() - started;
575+
int64_t duration = bson_get_monotonic_time () - started;
569576

570577
/*
571578
* Unacknowledged writes must provide a CommandSucceededEvent with an
@@ -577,46 +584,45 @@ mongoc_cluster_run_command_monitored (mongoc_cluster_t *cluster,
577584
}
578585

579586
// @todo Provide missing arguments
580-
mongoc_structured_log_command_success (
581-
cmd->command_name,
582-
cmd->operation_id,
583-
cmd->is_acknowledged ? reply : &fake_reply,
584-
duration,
585-
request_id,
586-
0,
587-
0,
588-
false);
587+
mongoc_structured_log_command_success (cmd->command_name,
588+
cmd->operation_id,
589+
cmd->is_acknowledged ? reply
590+
: &fake_reply,
591+
duration,
592+
request_id,
593+
0,
594+
0,
595+
false);
589596

590597
if (callbacks->succeeded) {
591-
mongoc_apm_command_succeeded_init (
592-
&succeeded_event,
593-
duration,
594-
cmd->is_acknowledged ? reply : &fake_reply,
595-
cmd->command_name,
596-
request_id,
597-
cmd->operation_id,
598-
&server_stream->sd->host,
599-
server_id,
600-
cluster->client->apm_context);
598+
mongoc_apm_command_succeeded_init (&succeeded_event,
599+
duration,
600+
cmd->is_acknowledged ? reply
601+
: &fake_reply,
602+
cmd->command_name,
603+
request_id,
604+
cmd->operation_id,
605+
&server_stream->sd->host,
606+
server_id,
607+
cluster->client->apm_context);
601608

602609
callbacks->succeeded (&succeeded_event);
603610
mongoc_apm_command_succeeded_cleanup (&succeeded_event);
604611
}
605612

606613
bson_destroy (&fake_reply);
607614
} else {
608-
int64_t duration = bson_get_monotonic_time() - started;
615+
int64_t duration = bson_get_monotonic_time () - started;
609616

610617
// @todo Provide missing arguments
611-
mongoc_structured_log_command_failure (
612-
cmd->command_name,
613-
cmd->operation_id,
614-
reply,
615-
error,
616-
cluster->request_id,
617-
0,
618-
0,
619-
false);
618+
mongoc_structured_log_command_failure (cmd->command_name,
619+
cmd->operation_id,
620+
reply,
621+
error,
622+
cluster->request_id,
623+
0,
624+
0,
625+
false);
620626

621627
if (callbacks->failed) {
622628
mongoc_apm_command_failed_init (&failed_event,

src/libmongoc/src/mongoc/mongoc-cursor-legacy.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ _mongoc_cursor_monitor_legacy_get_more (mongoc_cursor_t *cursor,
5151
db = bson_strndup (cursor->ns, cursor->dblen);
5252

5353
// @todo Provide missing arguments
54-
mongoc_structured_log_command_started (&doc, "getMore", db, cursor->operation_id, client->cluster.request_id, 0, 0, false);
54+
mongoc_structured_log_command_started (&doc,
55+
"getMore",
56+
db,
57+
cursor->operation_id,
58+
client->cluster.request_id,
59+
0,
60+
0,
61+
false);
5562

5663
if (!client->apm_callbacks.started) {
5764
/* successful */

src/libmongoc/src/mongoc/mongoc-cursor.c

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,14 @@ _mongoc_cursor_monitor_command (mongoc_cursor_t *cursor,
700700
db = bson_strndup (cursor->ns, cursor->dblen);
701701

702702
// @todo Provide missing arguments
703-
mongoc_structured_log_command_started (cmd, cmd_name, db, cursor->operation_id, client->cluster.request_id, 0, 0, false);
703+
mongoc_structured_log_command_started (cmd,
704+
cmd_name,
705+
db,
706+
cursor->operation_id,
707+
client->cluster.request_id,
708+
0,
709+
0,
710+
false);
704711

705712
if (!client->apm_callbacks.started) {
706713
/* successful */
@@ -785,15 +792,14 @@ _mongoc_cursor_monitor_succeeded (mongoc_cursor_t *cursor,
785792
bson_destroy (&docs_array);
786793

787794
// @todo Provide missing arguments
788-
mongoc_structured_log_command_success (
789-
cmd_name,
790-
cursor->operation_id,
791-
&reply,
792-
duration,
793-
client->cluster.request_id,
794-
0,
795-
0,
796-
false);
795+
mongoc_structured_log_command_success (cmd_name,
796+
cursor->operation_id,
797+
&reply,
798+
duration,
799+
client->cluster.request_id,
800+
0,
801+
0,
802+
false);
797803

798804
if (!client->apm_callbacks.succeeded) {
799805
bson_destroy (&reply);
@@ -840,15 +846,14 @@ _mongoc_cursor_monitor_failed (mongoc_cursor_t *cursor,
840846
bson_append_int32 (&reply, "ok", 2, 0);
841847

842848
// @todo Provide missing arguments
843-
mongoc_structured_log_command_failure (
844-
cmd_name,
845-
cursor->operation_id,
846-
&reply,
847-
&cursor->error,
848-
client->cluster.request_id,
849-
0,
850-
0,
851-
false);
849+
mongoc_structured_log_command_failure (cmd_name,
850+
cursor->operation_id,
851+
&reply,
852+
&cursor->error,
853+
client->cluster.request_id,
854+
0,
855+
0,
856+
false);
852857

853858
if (!client->apm_callbacks.failed) {
854859
bson_destroy (&reply);

src/libmongoc/src/mongoc/mongoc-structured-log.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ mongoc_structured_log (mongoc_structured_log_level_t level,
128128
static mongoc_structured_log_level_t
129129
_mongoc_structured_log_get_log_level_from_env (const char *variable)
130130
{
131-
const char* level = getenv (variable);
131+
const char *level = getenv (variable);
132132

133133
if (!level) {
134134
return MONGOC_STRUCTURED_LOG_DEFAULT_LEVEL;
@@ -151,33 +151,40 @@ _mongoc_structured_log_get_log_level_from_env (const char *variable)
151151
} else if (!strcasecmp (level, "emergency")) {
152152
return MONGOC_STRUCTURED_LOG_LEVEL_EMERGENCY;
153153
} else {
154-
MONGOC_ERROR ("Invalid log level %s read for variable %s", level, variable);
154+
MONGOC_ERROR (
155+
"Invalid log level %s read for variable %s", level, variable);
155156
exit (EXIT_FAILURE);
156157
}
157158
}
158159

159160
static mongoc_structured_log_level_t
160-
_mongoc_structured_log_get_log_level (mongoc_structured_log_component_t component)
161+
_mongoc_structured_log_get_log_level (
162+
mongoc_structured_log_component_t component)
161163
{
162164
switch (component) {
163165
case MONGOC_STRUCTURED_LOG_COMPONENT_COMMAND:
164-
return _mongoc_structured_log_get_log_level_from_env ("MONGODB_LOGGING_COMMAND");
166+
return _mongoc_structured_log_get_log_level_from_env (
167+
"MONGODB_LOGGING_COMMAND");
165168
case MONGOC_STRUCTURED_LOG_COMPONENT_CONNECTION:
166-
return _mongoc_structured_log_get_log_level_from_env ("MONGODB_LOGGING_CONNECTION");
169+
return _mongoc_structured_log_get_log_level_from_env (
170+
"MONGODB_LOGGING_CONNECTION");
167171
case MONGOC_STRUCTURED_LOG_COMPONENT_SDAM:
168-
return _mongoc_structured_log_get_log_level_from_env ("MONGODB_LOGGING_SDAM");
172+
return _mongoc_structured_log_get_log_level_from_env (
173+
"MONGODB_LOGGING_SDAM");
169174
case MONGOC_STRUCTURED_LOG_COMPONENT_SERVER_SELECTION:
170-
return _mongoc_structured_log_get_log_level_from_env ("MONGODB_LOGGING_SERVER_SELECTION");
175+
return _mongoc_structured_log_get_log_level_from_env (
176+
"MONGODB_LOGGING_SERVER_SELECTION");
171177
default:
172-
MONGOC_ERROR ("Requesting log level for unsupported component %d", component);
178+
MONGOC_ERROR ("Requesting log level for unsupported component %d",
179+
component);
173180
exit (EXIT_FAILURE);
174181
}
175182
}
176183

177184
static void
178185
_mongoc_structured_log_initialize_stream ()
179186
{
180-
const char* log_target = getenv("MONGODB_LOGGING_PATH");
187+
const char *log_target = getenv ("MONGODB_LOGGING_PATH");
181188
bool log_to_stderr = !log_target || !strcmp (log_target, "stderr");
182189

183190
log_stream = log_to_stderr ? stderr : fopen (log_target, "a");
@@ -187,7 +194,7 @@ _mongoc_structured_log_initialize_stream ()
187194
}
188195
}
189196

190-
static FILE*
197+
static FILE *
191198
_mongoc_structured_log_get_stream ()
192199
{
193200
if (!log_stream) {
@@ -201,7 +208,9 @@ static void
201208
mongoc_structured_log_default_handler (mongoc_structured_log_entry_t *entry,
202209
void *user_data)
203210
{
204-
mongoc_structured_log_level_t log_level = _mongoc_structured_log_get_log_level (mongoc_structured_log_entry_get_component (entry));
211+
mongoc_structured_log_level_t log_level =
212+
_mongoc_structured_log_get_log_level (
213+
mongoc_structured_log_entry_get_component (entry));
205214

206215
if (log_level < mongoc_structured_log_entry_get_level (entry)) {
207216
return;

0 commit comments

Comments
 (0)