<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16390] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16390">16390</a></dd>
<dt>Author</dt> <dd>mrene</dd>
<dt>Date</dt> <dd>2010-01-18 13:29:39 -0600 (Mon, 18 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>backport per-session loglevel from stkn's branch</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcincludeprivateswitch_core_pvth">freeswitch/trunk/src/include/private/switch_core_pvt.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_channelh">freeswitch/trunk/src/include/switch_channel.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_coreh">freeswitch/trunk/src/include/switch_core.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_typesh">freeswitch/trunk/src/include/switch_types.h</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_commandsmod_commandsc">freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_dptoolsmod_dptoolsc">freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_channelc">freeswitch/trunk/src/switch_channel.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_core_sessionc">freeswitch/trunk/src/switch_core_session.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_logc">freeswitch/trunk/src/switch_log.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcincludeprivateswitch_core_pvth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/private/switch_core_pvt.h        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -156,6 +156,7 @@
</span><span class="cx">         uint32_t read_frame_count;
</span><span class="cx">         uint32_t track_duration;
</span><span class="cx">         uint32_t track_id;
</span><ins>+        switch_log_level_t loglevel;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct switch_media_bug {
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_channelh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_channel.h (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_channel.h        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/include/switch_channel.h        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -537,6 +537,7 @@
</span><span class="cx"> SWITCH_DECLARE(int) switch_channel_test_app_flag(switch_channel_t *channel, uint32_t flags);
</span><span class="cx"> SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel);
</span><span class="cx"> SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel);
</span><ins>+SWITCH_DECLARE(switch_core_session_t*) switch_channel_get_session(switch_channel_t *channel);
</ins><span class="cx"> 
</span><span class="cx"> /** @} */
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_coreh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_core.h (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_core.h        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/include/switch_core.h        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -676,7 +676,23 @@
</span><span class="cx"> */
</span><span class="cx"> SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> /*! 
</span><ins>+  \brief Sets the log level for a session
+  \param session the session to set the log level on 
+  \return SWITCH_STATUS_SUCCESS
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel);
+
+
+/*! 
+  \brief Get the log level for a session
+  \param session the session to get the log level from 
+  \return the log level
+*/
+SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session);
+
+/*! 
</ins><span class="cx">   \brief Retrieve the unique identifier from the core
</span><span class="cx">   \return a string representing the uuid
</span><span class="cx"> */
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_typesh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_types.h (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_types.h        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/include/switch_types.h        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -805,7 +805,8 @@
</span><span class="cx"> typedef enum {
</span><span class="cx">         SWITCH_CHANNEL_ID_LOG,
</span><span class="cx">         SWITCH_CHANNEL_ID_LOG_CLEAN,
</span><del>-        SWITCH_CHANNEL_ID_EVENT
</del><ins>+        SWITCH_CHANNEL_ID_EVENT,
+        SWITCH_CHANNEL_ID_SESSION
</ins><span class="cx"> } switch_text_channel_t;
</span><span class="cx"> 
</span><span class="cx"> typedef enum {
</span><span class="lines">@@ -817,11 +818,11 @@
</span><span class="cx"> 
</span><span class="cx"> #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
</span><span class="cx"> #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
</span><del>-#define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, ((x) ? switch_core_session_get_uuid(x) : NULL)
</del><ins>+#define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x))
</ins><span class="cx"> #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
</span><del>-#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, ((x) ? switch_core_session_get_uuid(x) : NULL)
-#define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, ((x) ? switch_channel_get_uuid(x) : NULL)
-#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, x
</del><ins>+#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x)
+#define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x)
+#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x)
</ins><span class="cx"> 
</span><span class="cx"> /*!
</span><span class="cx">   \enum switch_channel_state_t
</span></span></pre></div>
<a id="freeswitchtrunksrcmodapplicationsmod_commandsmod_commandsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -3997,6 +3997,41 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#define UUID_LOGLEVEL_SYNTAX &quot;&lt;uuid&gt; &lt;level&gt;&quot;
+SWITCH_STANDARD_API(uuid_loglevel)
+{
+        switch_core_session_t *tsession = NULL;
+        char *uuid = NULL, *text = NULL;
+
+        if (!zstr(cmd) &amp;&amp; (uuid = strdup(cmd))) {
+                if ((text = strchr(uuid, ' '))) {
+                        *text++ = '\0';
+                }
+        }
+
+        if (zstr(uuid) || zstr(text)) {
+                stream-&gt;write_function(stream, &quot;-USAGE: %s\n&quot;, UUID_LOGLEVEL_SYNTAX);
+        } else {
+                switch_log_level_t level = switch_log_str2level(text);
+
+                if (level == SWITCH_LOG_INVALID) {
+                        stream-&gt;write_function(stream, &quot;-ERR Invalid log level!\n&quot;);
+                }
+                else if ((tsession = switch_core_session_locate(uuid))) {
+
+                        switch_core_session_set_loglevel(tsession, level);
+                        stream-&gt;write_function(stream, &quot;+OK\n&quot;);
+                        switch_core_session_rwunlock(tsession);
+                }
+                else {
+                        stream-&gt;write_function(stream, &quot;-ERR No Such Channel %s!\n&quot;, uuid);
+                }
+        }
+
+        switch_safe_free(uuid);
+        return SWITCH_STATUS_SUCCESS;
+}
+
</ins><span class="cx"> SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
</span><span class="cx"> {
</span><span class="cx">         int x;
</span><span class="lines">@@ -4096,6 +4131,7 @@
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_getvar&quot;, &quot;uuid_getvar&quot;, uuid_getvar_function, GETVAR_SYNTAX);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_hold&quot;, &quot;hold&quot;, uuid_hold_function, HOLD_SYNTAX);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_kill&quot;, &quot;Kill Channel&quot;, kill_function, KILL_SYNTAX);
</span><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_loglevel&quot;, &quot;set loglevel on session&quot;, uuid_loglevel, UUID_LOGLEVEL_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_media&quot;, &quot;media&quot;, uuid_media_function, MEDIA_SYNTAX);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_park&quot;, &quot;Park Channel&quot;, park_function, PARK_SYNTAX);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_preprocess&quot;, &quot;Pre-process Channel&quot;, preprocess_function, PREPROCESS_SYNTAX);
</span><span class="lines">@@ -4119,6 +4155,14 @@
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl default_dtmf_duration&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl hupall&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl loglevel&quot;);
</span><ins>+        switch_console_set_complete(&quot;add fsctl loglevel console&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel alert&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel crit&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel err&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel warning&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel notice&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel info&quot;);
+        switch_console_set_complete(&quot;add fsctl loglevel debug&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add fsctl max_dtmf_duration&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl max_sessions&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl min_dtmf_duration&quot;);
</span><span class="lines">@@ -4181,6 +4225,14 @@
</span><span class="cx">         switch_console_set_complete(&quot;add uuid_getvar ::console::list_uuid&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add uuid_hold ::console::list_uuid&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add uuid_kill ::console::list_uuid&quot;);
</span><ins>+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid console&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid alert&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid crit&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid err&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid warning&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid notice&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid info&quot;);
+        switch_console_set_complete(&quot;add uuid_loglevel ::console::list_uuid debug&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add uuid_media ::console::list_uuid&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add uuid_park ::console::list_uuid&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add uuid_preprocess ::console::list_uuid&quot;);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodapplicationsmod_dptoolsmod_dptoolsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -2948,6 +2948,24 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+#define SESSION_LOGLEVEL_SYNTAX &quot;&lt;level&gt;&quot;
+SWITCH_STANDARD_APP(session_loglevel_function)
+{
+        if (!zstr(data)) {
+                switch_log_level_t level = switch_log_str2level(data);
+
+                if (level == SWITCH_LOG_INVALID) {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, &quot;Invalid log level: %s\n&quot;, data);
+                } else {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, &quot;Setting log level \&quot;%s\&quot; on session\n&quot;, switch_log_level2str(level));
+                        switch_core_session_set_loglevel(session, level);
+                }
+        } else {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, &quot;No log level specified\n&quot;);
+        }
+}
+
</ins><span class="cx"> #define SPEAK_DESC &quot;Speak text to a channel via the tts interface&quot;
</span><span class="cx"> #define DISPLACE_DESC &quot;Displace audio from a file to the channels input&quot;
</span><span class="cx"> #define SESS_REC_DESC &quot;Starts a background recording of the entire session&quot;
</span><span class="lines">@@ -3108,6 +3126,7 @@
</span><span class="cx">         SWITCH_ADD_APP(app_interface, &quot;say&quot;, &quot;say&quot;, &quot;say&quot;, say_function, SAY_SYNTAX, SAF_NONE);
</span><span class="cx"> 
</span><span class="cx">         SWITCH_ADD_APP(app_interface, &quot;wait_for_silence&quot;, &quot;wait_for_silence&quot;, &quot;wait_for_silence&quot;, wait_for_silence_function, WAIT_FOR_SILENCE_SYNTAX, SAF_NONE);
</span><ins>+        SWITCH_ADD_APP(app_interface, &quot;session_loglevel&quot;, &quot;session_loglevel&quot;, &quot;session_loglevel&quot;, session_loglevel_function, SESSION_LOGLEVEL_SYNTAX, SAF_SUPPORT_NOMEDIA);
</ins><span class="cx"> 
</span><span class="cx">         SWITCH_ADD_DIALPLAN(dp_interface, &quot;inline&quot;, inline_dialplan_hunt);
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_channelc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_channel.c (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_channel.c        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/switch_channel.c        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -2649,6 +2649,12 @@
</span><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SWITCH_DECLARE(switch_core_session_t*) switch_channel_get_session(switch_channel_t *channel)
+{
+        switch_assert(channel);
+        return channel-&gt;session;
+}
+
</ins><span class="cx"> SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel)
</span><span class="cx"> {
</span><span class="cx">         switch_status_t status = SWITCH_STATUS_SUCCESS;
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_core_sessionc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_core_session.c (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_core_session.c        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/switch_core_session.c        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -1712,6 +1712,19 @@
</span><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel)
+{
+       switch_assert(session != NULL);
+       session-&gt;loglevel = loglevel;
+       return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session)
+{
+       switch_assert(session != NULL);
+       return session-&gt;loglevel;
+}
+
</ins><span class="cx"> /* For Emacs:
</span><span class="cx">  * Local Variables:
</span><span class="cx">  * mode:c
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_logc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_log.c (16389 => 16390)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_log.c        2010-01-18 19:01:56 UTC (rev 16389)
+++ freeswitch/trunk/src/switch_log.c        2010-01-18 19:29:39 UTC (rev 16390)
</span><span class="lines">@@ -339,7 +339,15 @@
</span><span class="cx"> #else
</span><span class="cx">         const char *extra_fmt = &quot;%s [%s] %s:%d%c%s&quot;;
</span><span class="cx"> #endif
</span><ins>+        switch_log_level_t limit_level = runtime.hard_log_level;
</ins><span class="cx"> 
</span><ins>+        if (channel == SWITCH_CHANNEL_ID_SESSION &amp;&amp; userdata) {
+                switch_core_session_t *session = (switch_core_session_t*)userdata;
+                if (limit_level &lt; session-&gt;loglevel) {
+                        limit_level = session-&gt;loglevel;
+                }
+        }
+
</ins><span class="cx">         if (level &gt; 100) {
</span><span class="cx">                 if ((uint32_t)(level - 100) &gt; runtime.debug_level) {
</span><span class="cx">                         return;
</span><span class="lines">@@ -348,7 +356,7 @@
</span><span class="cx">                 level = 7;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (level &gt; runtime.hard_log_level) {
</del><ins>+        if (level &gt; limit_level) {
</ins><span class="cx">                 return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -466,7 +474,11 @@
</span><span class="cx">                 node-&gt;content = content;
</span><span class="cx">                 node-&gt;timestamp = now;
</span><span class="cx">                 node-&gt;channel = channel;
</span><del>-                node-&gt;userdata = !zstr(userdata) ? strdup(userdata) : NULL;
</del><ins>+                if (channel == SWITCH_CHANNEL_ID_SESSION) {
+                        node-&gt;userdata = userdata ? strdup(switch_core_session_get_uuid((switch_core_session_t*)userdata)) : NULL;
+                } else {
+                        node-&gt;userdata = !zstr(userdata) ? strdup(userdata) : NULL;
+                }
</ins><span class="cx"> 
</span><span class="cx">                 if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                         switch_log_node_free(&amp;node);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>