Merge pull request #4621 from alexanderkyte/strdup_env
[mono.git] / mono / utils / mono-logger.c
index 5cc59c77fbe6dd87bf56d097df56dc7380e9baf9..aeaa3f97ceefab0bc79fe685d042ade9a91d5368 100644 (file)
@@ -1,3 +1,7 @@
+/**
+ * \file
+ */
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -43,10 +47,20 @@ mono_trace_init (void)
                mono_internal_current_level = G_LOG_LEVEL_ERROR;
                level_stack = g_queue_new();
 
-               mono_trace_set_mask_string(g_getenv("MONO_LOG_MASK"));
-               mono_trace_set_level_string(g_getenv("MONO_LOG_LEVEL"));
-               mono_trace_set_logheader_string(g_getenv("MONO_LOG_HEADER"));
-               mono_trace_set_logdest_string(g_getenv("MONO_LOG_DEST"));
+               char *mask = g_getenv ("MONO_LOG_MASK");
+               char *level = g_getenv ("MONO_LOG_LEVEL");
+               char *header = g_getenv ("MONO_LOG_HEADER");
+               char *dest = g_getenv ("MONO_LOG_DEST");
+
+               mono_trace_set_mask_string(mask);
+               mono_trace_set_level_string(level);
+               mono_trace_set_logheader_string(header);
+               mono_trace_set_logdest_string(dest);
+
+               g_free (mask);
+               g_free (level);
+               g_free (header);
+               g_free (dest);
        }
 }
 
@@ -70,11 +84,9 @@ mono_trace_cleanup (void)
 }
 
 /**
- * mono_tracev:
- *
- *     @level: Verbose level of the specified message
- *     @mask: Type of the specified message
- *
+ * mono_tracev_inner:
+ * \param level Verbose level of the specified message
+ * \param mask Type of the specified message
  * Traces a new message, depending on the current logging level
  * and trace mask.
  */
@@ -98,11 +110,9 @@ mono_tracev_inner (GLogLevelFlags level, MonoTraceMask mask, const char *format,
 
 /**
  * mono_trace_set_level:
- *
- *     @level: Verbose level to set
- *
+ * \param level Verbose level to set
  * Sets the current logging level. Every subsequent call to
- * mono_trace will check the visibility of a message against this
+ * \c mono_trace will check the visibility of a message against this
  * value.
  */
 void 
@@ -116,11 +126,9 @@ mono_trace_set_level (GLogLevelFlags level)
 
 /**
  * mono_trace_set_mask:
- *
- *     @mask: Mask of visible message types.
- *
+ * \param mask Mask of visible message types.
  * Sets the current logging level. Every subsequent call to
- * mono_trace will check the visibility of a message against this
+ * \c mono_trace will check the visibility of a message against this
  * value.
  */
 void 
@@ -134,9 +142,7 @@ mono_trace_set_mask (MonoTraceMask mask)
 
 /**
  * mono_trace_set_logdest:
- *
- *     @dest: Destination for logging
- *
+ * \param dest Destination for logging
  * Sets the current logging destination. This can be a file or, if supported,
  * syslog.
  */
@@ -176,9 +182,7 @@ mono_trace_set_logdest_string (const char *dest)
 
 /**
  * mono_trace_set_logheader:
- *
- *     @head: Whether we want pid/date/time header on log messages
- *
+ * \param head Whether we want pid/date/time header on log messages
  * Sets the current logging header option.
  */
 void 
@@ -193,11 +197,9 @@ mono_trace_set_logheader_string(const char *head)
 
 /**
  * mono_trace_push:
- *
- *     @level: Verbose level to set
- *     @mask: Mask of visible message types.
- *
- * Saves the current values of level and mask then calls mono_trace_set
+ * \param level Verbose level to set
+ * \param mask Mask of visible message types.
+ * Saves the current values of level and mask then calls \c mono_trace_set
  * with the specified new values.
  */
 void 
@@ -432,10 +434,8 @@ structured_log_adapter (const gchar *log_domain, GLogLevelFlags log_level, const
 
 /**
  * mono_trace_set_log_handler_internal:
- *
- *  @callback The callback that will replace the default logging handler
- *  @user_data Argument passed to @callback
- *
+ * \param callback The callback that will replace the default logging handler
+ * \param user_data Argument passed to \p callback
  * The log handler replaces the default runtime logger. All logging requests with be routed to it.
  * If the fatal argument in the callback is true, the callback must abort the current process. The runtime expects that
  * execution will not resume after a fatal error.
@@ -470,11 +470,8 @@ printerr_handler (const char *string)
 
 /**
  * mono_trace_set_print_handler:
- *
- * @callback The callback that will replace the default runtime behavior for stdout output.
- *
+ * \param callback The callback that will replace the default runtime behavior for stdout output.
  * The print handler replaces the default runtime stdout output handler. This is used by free form output done by the runtime.
- *
  */
 void
 mono_trace_set_print_handler (MonoPrintCallback callback)
@@ -486,11 +483,8 @@ mono_trace_set_print_handler (MonoPrintCallback callback)
 
 /**
  * mono_trace_set_printerr_handler:
- *
- * @callback The callback that will replace the default runtime behavior for stderr output.
- *
+ * \param callback The callback that will replace the default runtime behavior for stderr output.
  * The print handler replaces the default runtime stderr output handler. This is used by free form output done by the runtime.
- *
  */
 void
 mono_trace_set_printerr_handler (MonoPrintCallback callback)