iodine 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of iodine might be problematic. Click here for more details.

@@ -62,14 +62,15 @@ static void fio_cli_map_line2alias(char const *line) {
62
62
  while (n.data[n.len] && n.data[n.len] != ' ' && n.data[n.len] != ',') {
63
63
  ++n.len;
64
64
  }
65
- const char **old = fio_hash_find(&fio_aliases, FIO_CLI_HASH_VAL(n), n);
65
+ const char *old = NULL;
66
+ fio_hash_insert(&fio_aliases, FIO_CLI_HASH_VAL(n), n, (void *)line, &old);
66
67
  if (old) {
67
68
  FIO_LOG_WARNING("CLI argument name conflict detected\n"
68
69
  " The following two directives conflict:\n"
69
70
  "\t%s\n\t%s\n",
70
- *old, line);
71
+ old, line);
71
72
  }
72
- fio_hash_insert(&fio_aliases, FIO_CLI_HASH_VAL(n), n, (void *)line);
73
+
73
74
  while (n.data[n.len] && (n.data[n.len] == ' ' || n.data[n.len] == ',')) {
74
75
  ++n.len;
75
76
  }
@@ -121,7 +122,7 @@ static void fio_cli_set_arg(cstr_s arg, char const *value, char const *line,
121
122
  goto print_help;
122
123
  }
123
124
  cstr_s n = {.len = ++parser->unknown_count};
124
- fio_hash_insert(&fio_values, n.len, n, value);
125
+ fio_hash_insert(&fio_values, n.len, n, value, NULL);
125
126
  if (!parser->allow_unknown) {
126
127
  arg.len = 0;
127
128
  goto error;
@@ -169,7 +170,7 @@ static void fio_cli_set_arg(cstr_s arg, char const *value, char const *line,
169
170
  while (n.data[n.len] && n.data[n.len] != ' ' && n.data[n.len] != ',') {
170
171
  ++n.len;
171
172
  }
172
- fio_hash_insert(&fio_values, FIO_CLI_HASH_VAL(n), n, value);
173
+ fio_hash_insert(&fio_values, FIO_CLI_HASH_VAL(n), n, value, NULL);
173
174
  while (n.data[n.len] && (n.data[n.len] == ' ' || n.data[n.len] == ',')) {
174
175
  ++n.len;
175
176
  }
@@ -321,7 +322,7 @@ void fio_cli_start AVOID_MACRO(int argc, char const *argv[], int allow_unknown,
321
322
  if (parser.pos + 1 < argc) {
322
323
  value = argv[parser.pos + 1];
323
324
  }
324
- const char **l = NULL;
325
+ const char *l = NULL;
325
326
  while (n.len &&
326
327
  !(l = fio_hash_find(&fio_aliases, FIO_CLI_HASH_VAL(n), n))) {
327
328
  --n.len;
@@ -331,7 +332,7 @@ void fio_cli_start AVOID_MACRO(int argc, char const *argv[], int allow_unknown,
331
332
  ++value;
332
333
  }
333
334
  // fprintf(stderr, "Setting %.*s to %s\n", (int)n.len, n.data, value);
334
- fio_cli_set_arg(n, value, (l ? (*l) : NULL), &parser);
335
+ fio_cli_set_arg(n, value, l, &parser);
335
336
  }
336
337
 
337
338
  /* Cleanup and save state for API */
@@ -354,10 +355,7 @@ char const *fio_cli_get(char const *name) {
354
355
  if (!fio_hash_count(&fio_values)) {
355
356
  return NULL;
356
357
  }
357
- const char **val = fio_hash_find(&fio_values, FIO_CLI_HASH_VAL(n), n);
358
- if (val)
359
- return *val;
360
- return NULL;
358
+ return fio_hash_find(&fio_values, FIO_CLI_HASH_VAL(n), n);
361
359
  }
362
360
 
363
361
  /** Returns the argument's value as an integer. */
@@ -394,10 +392,7 @@ char const *fio_cli_unknown(unsigned int index) {
394
392
  return NULL;
395
393
  }
396
394
  cstr_s n = {.data = NULL, .len = index + 1};
397
- const char **val = fio_hash_find(&fio_values, index + 1, n);
398
- if (val)
399
- return *val;
400
- return NULL;
395
+ return fio_hash_find(&fio_values, index + 1, n);
401
396
  }
402
397
 
403
398
  /**
@@ -408,5 +403,5 @@ char const *fio_cli_unknown(unsigned int index) {
408
403
  */
409
404
  void fio_cli_set(char const *name, char const *value) {
410
405
  cstr_s n = (cstr_s){.data = name, .len = strlen(name)};
411
- fio_hash_insert(&fio_values, FIO_CLI_HASH_VAL(n), n, value);
406
+ fio_hash_insert(&fio_values, FIO_CLI_HASH_VAL(n), n, value, NULL);
412
407
  }
@@ -199,7 +199,7 @@ int fiobj_hash_set(FIOBJ hash, FIOBJ key, FIOBJ obj) {
199
199
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
200
200
  if (FIOBJ_TYPE_IS(key, FIOBJ_T_STRING))
201
201
  fiobj_str_freeze(key);
202
- fio_hash_insert(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, obj);
202
+ fio_hash_insert(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, obj, NULL);
203
203
  return 0;
204
204
  }
205
205
 
@@ -216,11 +216,11 @@ int fiobj_hash_set(FIOBJ hash, FIOBJ key, FIOBJ obj) {
216
216
  FIOBJ fiobj_hash_pop(FIOBJ hash, FIOBJ *key) {
217
217
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
218
218
  FIOBJ old;
219
- if (!fio_hash_last(&obj2hash(hash)->hash))
219
+ if (fio_hash_count(&obj2hash(hash)->hash))
220
220
  return FIOBJ_INVALID;
221
- old = fiobj_dup(fio_hash_last(&obj2hash(hash)->hash)->obj);
221
+ old = fiobj_dup(fio_hash_last(&obj2hash(hash)->hash).obj);
222
222
  if (key)
223
- *key = fiobj_dup(fio_hash_last(&obj2hash(hash)->hash)->key);
223
+ *key = fiobj_dup(fio_hash_last(&obj2hash(hash)->hash).key);
224
224
  fio_hash_pop(&obj2hash(hash)->hash);
225
225
  return old;
226
226
  }
@@ -237,7 +237,7 @@ FIOBJ fiobj_hash_pop(FIOBJ hash, FIOBJ *key) {
237
237
  FIOBJ fiobj_hash_replace(FIOBJ hash, FIOBJ key, FIOBJ obj) {
238
238
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
239
239
  FIOBJ old = FIOBJ_INVALID;
240
- fio_hash_insert2(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, obj, &old);
240
+ fio_hash_insert(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, obj, &old);
241
241
  return old;
242
242
  }
243
243
 
@@ -247,7 +247,7 @@ FIOBJ fiobj_hash_replace(FIOBJ hash, FIOBJ key, FIOBJ obj) {
247
247
  FIOBJ fiobj_hash_remove(FIOBJ hash, FIOBJ key) {
248
248
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
249
249
  FIOBJ old = FIOBJ_INVALID;
250
- fio_hash_remove2(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, &old);
250
+ fio_hash_remove(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, &old);
251
251
  return old;
252
252
  }
253
253
 
@@ -258,7 +258,7 @@ FIOBJ fiobj_hash_remove(FIOBJ hash, FIOBJ key) {
258
258
  FIOBJ fiobj_hash_remove2(FIOBJ hash, uint64_t hash_value) {
259
259
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
260
260
  FIOBJ old = FIOBJ_INVALID;
261
- fio_hash_remove2(&obj2hash(hash)->hash, hash_value, -1, &old);
261
+ fio_hash_remove(&obj2hash(hash)->hash, hash_value, -1, &old);
262
262
  return old;
263
263
  }
264
264
 
@@ -283,7 +283,7 @@ int fiobj_hash_delete(FIOBJ hash, FIOBJ key) {
283
283
  * Returns -1 on type error or if the object never existed.
284
284
  */
285
285
  int fiobj_hash_delete2(FIOBJ hash, uint64_t key_hash) {
286
- return fio_hash_remove(&obj2hash(hash)->hash, key_hash, -1);
286
+ return fio_hash_remove(&obj2hash(hash)->hash, key_hash, -1, NULL);
287
287
  }
288
288
 
289
289
  /**
@@ -292,10 +292,8 @@ int fiobj_hash_delete2(FIOBJ hash, uint64_t key_hash) {
292
292
  */
293
293
  FIOBJ fiobj_hash_get(const FIOBJ hash, FIOBJ key) {
294
294
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
295
- FIOBJ *old = fio_hash_find(&obj2hash(hash)->hash, fiobj_obj2hash(key), key);
296
- if (old)
297
- return *old;
298
- return FIOBJ_INVALID;
295
+ return fio_hash_find(&obj2hash(hash)->hash, fiobj_obj2hash(key), key);
296
+ ;
299
297
  }
300
298
 
301
299
  /**
@@ -308,10 +306,8 @@ FIOBJ fiobj_hash_get(const FIOBJ hash, FIOBJ key) {
308
306
  */
309
307
  FIOBJ fiobj_hash_get2(const FIOBJ hash, uint64_t key_hash) {
310
308
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
311
- FIOBJ *old = fio_hash_find(&obj2hash(hash)->hash, key_hash, -1);
312
- if (old)
313
- return *old;
314
- return FIOBJ_INVALID;
309
+ return fio_hash_find(&obj2hash(hash)->hash, key_hash, -1);
310
+ ;
315
311
  }
316
312
 
317
313
  /**
@@ -319,7 +315,8 @@ FIOBJ fiobj_hash_get2(const FIOBJ hash, uint64_t key_hash) {
319
315
  */
320
316
  int fiobj_hash_haskey(const FIOBJ hash, FIOBJ key) {
321
317
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
322
- return fio_hash_find(&obj2hash(hash)->hash, fiobj_obj2hash(key), key) != NULL;
318
+ return fio_hash_find(&obj2hash(hash)->hash, fiobj_obj2hash(key), key) !=
319
+ FIOBJ_INVALID;
323
320
  }
324
321
 
325
322
  /**
@@ -1270,8 +1270,7 @@ uintptr_t http_sse_subscribe(http_sse_s *sse_,
1270
1270
  return 0;
1271
1271
 
1272
1272
  fio_lock(&sse->lock);
1273
- fio_ls_push(&sse->subscriptions, sub);
1274
- fio_ls_s *pos = sse->subscriptions.prev;
1273
+ fio_ls_s *pos = fio_ls_push(&sse->subscriptions, sub);
1275
1274
  fio_unlock(&sse->lock);
1276
1275
  return (uintptr_t)pos;
1277
1276
  }
@@ -2641,10 +2640,10 @@ void http_mimetype_register(char *file_ext, size_t file_ext_len,
2641
2640
  FIOBJ mime_type_str) {
2642
2641
  uintptr_t hash = fio_siphash(file_ext, file_ext_len);
2643
2642
  if (mime_type_str == FIOBJ_INVALID) {
2644
- fio_mime_set_remove(&mime_types, hash, FIOBJ_INVALID);
2643
+ fio_mime_set_remove(&mime_types, hash, FIOBJ_INVALID, NULL);
2645
2644
  } else {
2646
2645
  FIOBJ old = FIOBJ_INVALID;
2647
- fio_mime_set_replace(&mime_types, hash, mime_type_str, &old);
2646
+ fio_mime_set_overwrite(&mime_types, hash, mime_type_str, &old);
2648
2647
  if (old != FIOBJ_INVALID) {
2649
2648
  FIO_LOG_WARNING("mime-type collision: %.*s was %s, now %s",
2650
2649
  (int)file_ext_len, file_ext, fiobj_obj2cstr(old).data,
@@ -2660,10 +2659,7 @@ void http_mimetype_register(char *file_ext, size_t file_ext_len,
2660
2659
  */
2661
2660
  FIOBJ http_mimetype_find(char *file_ext, size_t file_ext_len) {
2662
2661
  uintptr_t hash = fio_siphash(file_ext, file_ext_len);
2663
- FIOBJ *result = fio_mime_set_find(&mime_types, hash, FIOBJ_INVALID);
2664
- if (result)
2665
- return fiobj_dup(*result);
2666
- return FIOBJ_INVALID;
2662
+ return fiobj_dup(fio_mime_set_find(&mime_types, hash, FIOBJ_INVALID));
2667
2663
  }
2668
2664
 
2669
2665
  /**
@@ -117,6 +117,49 @@ static VALUE iodine_threads_set(VALUE self, VALUE val) {
117
117
  return val;
118
118
  }
119
119
 
120
+ /**
121
+ * Gets the logging level used for Iodine messages.
122
+ *
123
+ * Levels range from 0-5, where:
124
+ *
125
+ * 0 == Quite (no messages)
126
+ * 1 == Fatal Errors only.
127
+ * 2 == Errors only (including fatal errors).
128
+ * 3 == Warnings and errors only.
129
+ * 4 == Informational messages, warnings and errors (default).
130
+ * 5 == Everything, including debug information.
131
+ *
132
+ * Logging is always performed to the process's STDERR and can be piped away.
133
+ *
134
+ * NOTE: this does NOT effect HTTP logging.
135
+ */
136
+ static VALUE iodine_logging_get(VALUE self) {
137
+ return INT2FIX(FIO_LOG_LEVEL);
138
+ (void)self;
139
+ }
140
+
141
+ /**
142
+ * Gets the logging level used for Iodine messages.
143
+ *
144
+ * Levels range from 0-5, where:
145
+ *
146
+ * 0 == Quite (no messages)
147
+ * 1 == Fatal Errors only.
148
+ * 2 == Errors only (including fatal errors).
149
+ * 3 == Warnings and errors only.
150
+ * 4 == Informational messages, warnings and errors (default).
151
+ * 5 == Everything, including debug information.
152
+ *
153
+ * Logging is always performed to the process's STDERR and can be piped away.
154
+ *
155
+ * NOTE: this does NOT effect HTTP logging.
156
+ */
157
+ static VALUE iodine_logging_set(VALUE self, VALUE val) {
158
+ Check_Type(val, T_FIXNUM);
159
+ FIO_LOG_LEVEL = FIX2ULONG(val);
160
+ return self;
161
+ }
162
+
120
163
  /**
121
164
  *Returns the number of worker processes that will be used when {Iodine.start}
122
165
  * is called.
@@ -156,13 +199,13 @@ static void iodine_print_startup_message(iodine_start_params_s params) {
156
199
  VALUE iodine_version = rb_const_get(IodineModule, rb_intern("VERSION"));
157
200
  VALUE ruby_version = rb_const_get(IodineModule, rb_intern("RUBY_VERSION"));
158
201
  fio_expected_concurrency(&params.threads, &params.workers);
159
- fprintf(stderr,
160
- "\nStarting up Iodine:\n"
161
- " * Iodine %s\n * Ruby %s\n * facil.io " FIO_VERSION_STRING " (%s)\n"
162
- " * %d Workers X %d Threads per worker.\n"
163
- "\n",
164
- StringValueCStr(iodine_version), StringValueCStr(ruby_version),
165
- fio_engine(), params.workers, params.threads);
202
+ FIO_LOG_INFO("Starting up Iodine:\n"
203
+ " * Iodine %s\n * Ruby %s\n"
204
+ " * facil.io " FIO_VERSION_STRING " (%s)\n"
205
+ " * %d Workers X %d Threads per worker.\n"
206
+ " * Master (root) process: %d.\n",
207
+ StringValueCStr(iodine_version), StringValueCStr(ruby_version),
208
+ fio_engine(), params.workers, params.threads, fio_parent_pid());
166
209
  (void)params;
167
210
  }
168
211
 
@@ -229,6 +272,8 @@ void Init_iodine(void) {
229
272
  // register core methods
230
273
  rb_define_module_function(IodineModule, "threads", iodine_threads_get, 0);
231
274
  rb_define_module_function(IodineModule, "threads=", iodine_threads_set, 1);
275
+ rb_define_module_function(IodineModule, "verbosity", iodine_logging_get, 0);
276
+ rb_define_module_function(IodineModule, "verbosity=", iodine_logging_set, 1);
232
277
  rb_define_module_function(IodineModule, "workers", iodine_workers_get, 0);
233
278
  rb_define_module_function(IodineModule, "workers=", iodine_workers_set, 1);
234
279
  rb_define_module_function(IodineModule, "start", iodine_start, 0);
@@ -3,6 +3,8 @@
3
3
  #include <ruby/thread.h>
4
4
  #include <string.h>
5
5
 
6
+ #include <fio.h>
7
+
6
8
  static __thread volatile uint8_t iodine_GVL_state;
7
9
 
8
10
  /* *****************************************************************************
@@ -28,18 +30,18 @@ static void *iodine_handle_exception(void *ignr) {
28
30
  VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
29
31
  if (TYPE(bt) == T_ARRAY) {
30
32
  bt = rb_ary_join(bt, rb_str_new_literal("\n"));
31
- fprintf(stderr, "Iodine caught an unprotected exception - %.*s: %.*s\n%s",
32
- (int)RSTRING_LEN(exc_class), RSTRING_PTR(exc_class),
33
- (int)RSTRING_LEN(msg), RSTRING_PTR(msg), StringValueCStr(bt));
33
+ FIO_LOG_ERROR("Iodine caught an unprotected exception - %.*s: %.*s\n%s",
34
+ (int)RSTRING_LEN(exc_class), RSTRING_PTR(exc_class),
35
+ (int)RSTRING_LEN(msg), RSTRING_PTR(msg),
36
+ StringValueCStr(bt));
34
37
  } else {
35
- fprintf(stderr,
36
- "Iodine caught an unprotected exception - %.*s: %.*s\n"
37
- "No backtrace available.\n",
38
- (int)RSTRING_LEN(exc_class), RSTRING_PTR(exc_class),
39
- (int)RSTRING_LEN(msg), RSTRING_PTR(msg));
38
+ FIO_LOG_ERROR("Iodine caught an unprotected exception - %.*s: %.*s\n"
39
+ "No backtrace available.\n",
40
+ (int)RSTRING_LEN(exc_class), RSTRING_PTR(exc_class),
41
+ (int)RSTRING_LEN(msg), RSTRING_PTR(msg));
40
42
  }
41
43
  rb_backtrace();
42
- fprintf(stderr, "\n\n");
44
+ FIO_LOG_ERROR("\n");
43
45
  rb_set_errinfo(Qnil);
44
46
  }
45
47
  return (void *)Qnil;
@@ -51,14 +51,14 @@ Pub/Sub storage
51
51
 
52
52
  static inline VALUE iodine_sub_unsubscribe(fio_subhash_s *store,
53
53
  fio_str_info_s channel) {
54
- if (fio_subhash_remove(store, fio_siphash(channel.data, channel.len),
55
- channel))
54
+ if (fio_subhash_remove(store, fio_siphash(channel.data, channel.len), channel,
55
+ NULL))
56
56
  return Qfalse;
57
57
  return Qtrue;
58
58
  }
59
59
  static inline void iodine_sub_add(fio_subhash_s *store, subscription_s *sub) {
60
60
  fio_str_info_s ch = fio_subscription_channel(sub);
61
- fio_subhash_insert(store, fio_siphash(ch.data, ch.len), ch, sub);
61
+ fio_subhash_insert(store, fio_siphash(ch.data, ch.len), ch, sub, NULL);
62
62
  }
63
63
  static inline void iodine_sub_clear_all(fio_subhash_s *store) {
64
64
  fio_subhash_free(store);
@@ -404,8 +404,7 @@ static iodine_sub_args_s iodine_subscribe_args(int argc, VALUE *argv) {
404
404
  /* temporary backport support */
405
405
  ret.channel = rb_hash_aref(argv[0], channel_id);
406
406
  if (ret.channel != Qnil) {
407
- fprintf(stderr,
408
- "WARNING: use of :channel in subscribe is deprecated.\n");
407
+ FIO_LOG_WARNING("use of :channel in subscribe is deprecated.");
409
408
  }
410
409
  }
411
410
  } else {
@@ -652,9 +651,7 @@ VALUE iodine_connection_new(iodine_connection_s args) {
652
651
  IodineStore.add(connection);
653
652
  iodine_connection_data_s *data = iodine_connection_ruby2C(connection);
654
653
  if (data == NULL) {
655
- fprintf(
656
- stderr,
657
- "ERROR: (iodine) internal error, connection object has no C data!\n");
654
+ FIO_LOG_ERROR("(iodine) internal error, connection object has no C data!");
658
655
  return Qnil;
659
656
  }
660
657
  *data = (iodine_connection_data_s){
@@ -677,17 +674,15 @@ void iodine_connection_fire_event(VALUE connection,
677
674
  iodine_connection_event_type_e ev,
678
675
  VALUE msg) {
679
676
  if (connection == Qnil) {
680
- fprintf(
681
- stderr,
682
- "ERROR: (iodine) nil connection handle used by an internal API call\n");
677
+ FIO_LOG_ERROR(
678
+ "(iodine) nil connection handle used by an internal API call");
683
679
  return;
684
680
  }
685
681
  iodine_connection_data_s *data = iodine_connection_validate_data(connection);
686
682
  if (!data) {
687
- fprintf(stderr,
688
- "ERROR: (iodine) invalid connection handle used by an "
689
- "internal API call: %p\n",
690
- (void *)connection);
683
+ FIO_LOG_ERROR("(iodine) invalid connection handle used by an "
684
+ "internal API call: %p",
685
+ (void *)connection);
691
686
  return;
692
687
  }
693
688
  VALUE args[2] = {connection, msg};
@@ -952,21 +952,19 @@ VALUE iodine_http_listen(VALUE self, VALUE opt) {
952
952
  .max_header_size = max_headers, .on_finish = free_iodine_http,
953
953
  .log = log_http, .max_body_size = max_body,
954
954
  .public_folder = (www ? StringValueCStr(www) : NULL)) == -1) {
955
- fprintf(stderr,
956
- "ERROR: Failed to initialize a listening HTTP socket for port %s\n",
957
- port ? StringValueCStr(port) : "3000");
955
+ FIO_LOG_ERROR("Failed to initialize a listening HTTP socket for port %s",
956
+ port ? StringValueCStr(port) : "3000");
958
957
  return Qfalse;
959
958
  }
960
959
 
961
960
  if ((app == Qnil || app == Qfalse)) {
962
- fprintf(stderr,
963
- "* Iodine: (no app) the HTTP service on port %s will only serve "
964
- "static files.\n",
965
- (port ? StringValueCStr(port) : "3000"));
961
+ FIO_LOG_WARNING(
962
+ "(listen2http) no app, the HTTP service on port %s will only serve "
963
+ "static files.",
964
+ (port ? StringValueCStr(port) : "3000"));
966
965
  }
967
966
  if (www) {
968
- fprintf(stderr, " * Serving static files from %s\n",
969
- StringValueCStr(www));
967
+ FIO_LOG_INFO("Serving static files from %s", StringValueCStr(www));
970
968
  }
971
969
 
972
970
  return Qtrue;
@@ -114,8 +114,8 @@ static int fio_json_on_start_object(json_parser_s *p) {
114
114
  static void fio_json_on_end_object(json_parser_s *p) {
115
115
  iodine_json_parser_s *pr = (iodine_json_parser_s *)p;
116
116
  if (pr->key) {
117
- fprintf(stderr, "WARNING: (JSON parsing) malformed JSON, "
118
- "ignoring dangling Hash key.\n");
117
+ FIO_LOG_WARNING("(JSON parsing) malformed JSON, "
118
+ "ignoring dangling Hash key.");
119
119
  IodineStore.remove(pr->key);
120
120
  pr->key = (VALUE)0;
121
121
  }
@@ -146,7 +146,7 @@ static void fio_json_on_json(json_parser_s *p) { (void)p; /* do nothing */ }
146
146
  static void fio_json_on_error(json_parser_s *p) {
147
147
  iodine_json_parser_s *pr = (iodine_json_parser_s *)p;
148
148
  #if DEBUG
149
- fprintf(stderr, "ERROR: JSON on error called.\n");
149
+ FIO_LOG_ERROR("JSON on error called.");
150
150
  #endif
151
151
  IodineStore.remove((VALUE)fio_ary_index(&pr->stack, 0));
152
152
  IodineStore.remove(pr->key);
@@ -192,20 +192,16 @@ static inline void iodine_json_update_settings(VALUE h,
192
192
  fiobj2rb_settings_s *s) {
193
193
  VALUE tmp;
194
194
  if (rb_hash_aref(h, max_nesting) != Qnil)
195
- fprintf(stderr,
196
- "WARNING: max_nesting ignored on this JSON implementation.\n");
195
+ FIO_LOG_WARNING("max_nesting ignored on this JSON implementation.");
197
196
  if (rb_hash_aref(h, allow_nan) != Qnil)
198
197
  fprintf(stderr, "WARNING: allow_nan ignored on this JSON implementation. "
199
198
  "NaN always allowed.\n");
200
199
  if (rb_hash_aref(h, create_additions) != Qnil)
201
- fprintf(stderr,
202
- "WARNING: create_additions ignored on this JSON implementation.\n");
200
+ FIO_LOG_WARNING("create_additions ignored on this JSON implementation.");
203
201
  if (rb_hash_aref(h, object_class) != Qnil)
204
- fprintf(stderr,
205
- "WARNING: object_class ignored on this JSON implementation.\n");
202
+ FIO_LOG_WARNING("object_class ignored on this JSON implementation.");
206
203
  if (rb_hash_aref(h, array_class) != Qnil)
207
- fprintf(stderr,
208
- "WARNING: array_class ignored on this JSON implementation.\n");
204
+ FIO_LOG_WARNING("array_class ignored on this JSON implementation.");
209
205
  if ((tmp = rb_hash_aref(h, symbolize_names)) != Qnil) {
210
206
  if (tmp == Qtrue)
211
207
  s->str2sym = 1;