You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/10/18 16:09:22 UTC

svn commit: r465253 - in /webservices/axis2/trunk/c/util: include/axis2_log.h src/log.c

Author: dinesh
Date: Wed Oct 18 07:09:22 2006
New Revision: 465253

URL: http://svn.apache.org/viewvc?view=rev&rev=465253
Log:
fixed:return type of log functions changed to void

Modified:
    webservices/axis2/trunk/c/util/include/axis2_log.h
    webservices/axis2/trunk/c/util/src/log.c

Modified: webservices/axis2/trunk/c/util/include/axis2_log.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axis2_log.h?view=diff&rev=465253&r1=465252&r2=465253
==============================================================================
--- webservices/axis2/trunk/c/util/include/axis2_log.h (original)
+++ webservices/axis2/trunk/c/util/include/axis2_log.h Wed Oct 18 07:09:22 2006
@@ -25,7 +25,7 @@
 #endif
 
     typedef struct axis2_log_ops axis2_log_ops_t;
-   typedef struct axis2_log axis2_log_t;
+	 typedef struct axis2_log axis2_log_t;
 
 
 #define AXIS2_LOG_SI __FILE__,__LINE__
@@ -88,7 +88,7 @@
        * @return axis2_status_t AXIS2_SUCCESS on success else AXIS2_FAILURE
        */
 
-       axis2_status_t (AXIS2_CALL *
+       void (AXIS2_CALL *
       free) (axis2_allocator_t *allocator, 
             struct axis2_log *log);
 
@@ -98,7 +98,7 @@
         * @param size size of the buffer to be written to log
         * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE
         */
-        axis2_status_t (AXIS2_CALL *
+        void (AXIS2_CALL *
        write) (axis2_log_t *log, 
              const axis2_char_t *buffer, 
              axis2_log_levels_t level,
@@ -122,35 +122,35 @@
 
     };
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL 
 axis2_log_impl_log_critical(axis2_log_t *log, 
                       const axis2_char_t *filename, 
                      const int linenumber,
                      const axis2_char_t *format,...);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL 
 axis2_log_impl_log_error(axis2_log_t *log,
                    const axis2_char_t *filename,
                    const int linenumber,
                    const axis2_char_t *format,...);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL 
 axis2_log_impl_log_warning(axis2_log_t *log,
                      const axis2_char_t *filename,
                           const int linenumber,
                           const axis2_char_t *format,...);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL 
 axis2_log_impl_log_info(axis2_log_t *log, 
                   const axis2_char_t *format,...);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL 
 axis2_log_impl_log_debug(axis2_log_t *log,
                    const axis2_char_t *filename,
                    const int linenumber,
                    const axis2_char_t *format,...);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL 
 axis2_log_impl_log_trace(axis2_log_t *log,
                          const axis2_char_t *filename,
                    const int linenumber,
@@ -185,3 +185,7 @@
 #endif
 
 #endif                          /* AXIS2_LOG_H */
+
+
+
+

Modified: webservices/axis2/trunk/c/util/src/log.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/log.c?view=diff&rev=465253&r1=465252&r2=465253
==============================================================================
--- webservices/axis2/trunk/c/util/src/log.c (original)
+++ webservices/axis2/trunk/c/util/src/log.c Wed Oct 18 07:09:22 2006
@@ -33,7 +33,7 @@
 
 #define AXIS2_INTF_TO_IMPL(log) ((axis2_log_impl_t*)(log))
 
-axis2_status_t AXIS2_CALL
+void AXIS2_CALL
 axis2_log_impl_free(axis2_allocator_t *allocator, axis2_log_t *log)
 {
     axis2_log_impl_t *log_impl = NULL;
@@ -59,15 +59,15 @@
         }
         AXIS2_FREE(allocator, log_impl);
     }
-    return AXIS2_SUCCESS;
+    
 }
 
 /* function prototypes */
-axis2_status_t AXIS2_CALL axis2_log_impl_write(axis2_log_t *log,
+void AXIS2_CALL axis2_log_impl_write(axis2_log_t *log,
         const axis2_char_t *buffer, axis2_log_levels_t level,
         const axis2_char_t *file, const int line);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_log_impl_write_to_file(FILE *fd,
+AXIS2_EXTERN void AXIS2_CALL axis2_log_impl_write_to_file(FILE *fd,
         axis2_thread_mutex_t *mutex, axis2_log_levels_t level,
         const axis2_char_t * file, const int line, const axis2_char_t * value);
 
@@ -173,51 +173,51 @@
 }
 
 /*TODO:remove this method*/
-axis2_status_t AXIS2_CALL
+void AXIS2_CALL
 axis2_log_impl_write(axis2_log_t *log, const axis2_char_t *buffer,
         axis2_log_levels_t level, const axis2_char_t *file, const int line)
 {
-    if (!log || !buffer)
-        return -1;
-    if (level <= log->level)
-    {
-        const char *level_str = "";
-        switch (level)
-        {
-            case AXIS2_LOG_LEVEL_CRITICAL:
-                level_str = "[critical] ";
-                break;
-            case AXIS2_LOG_LEVEL_ERROR:
-                level_str = "[error] ";
-                break;
-            case AXIS2_LOG_LEVEL_WARNING:
-                level_str = "[warning] ";
-                break;
-            case AXIS2_LOG_LEVEL_INFO:
-                level_str = "[info] ";
-                break;
-            case AXIS2_LOG_LEVEL_DEBUG:
-                level_str = "[debug] ";
-                break;
-            case AXIS2_LOG_LEVEL_TRACE:
-                level_str = "[...TRACE...] ";
-                break;
-        }
-        fprintf(stderr, "%s %s(%d) %s\n", level_str, file, line, buffer);
-    }
-
-    return 0;
+    if (log && buffer)
+		{
+        
+			 if (level <= log->level)
+				{
+					 const char *level_str = "";
+					 switch (level)
+						{
+							 case AXIS2_LOG_LEVEL_CRITICAL:
+								  level_str = "[critical] ";
+								  break;
+							 case AXIS2_LOG_LEVEL_ERROR:
+								  level_str = "[error] ";
+								  break;
+							 case AXIS2_LOG_LEVEL_WARNING:
+								  level_str = "[warning] ";
+								  break;
+							 case AXIS2_LOG_LEVEL_INFO:
+								  level_str = "[info] ";
+								  break;
+							 case AXIS2_LOG_LEVEL_DEBUG:
+								  level_str = "[debug] ";
+								  break;
+							 case AXIS2_LOG_LEVEL_TRACE:
+								  level_str = "[...TRACE...] ";
+								  break;
+						}
+					 fprintf(stderr, "%s %s(%d) %s\n", level_str, file, line, buffer);
+				}
+		}
+	 else
+		  fprintf (stderr, "please check your log and buffer");
 }
 
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_write_to_file(FILE *fd, axis2_thread_mutex_t *mutex,
         axis2_log_levels_t level, const axis2_char_t *file,
         const int line, const axis2_char_t *value)
 {
     const char *level_str = "";
-    if (!fd)
-        return -1;
     /**
        * print all critical and error logs irrespective of log->level setting
       */
@@ -252,125 +252,119 @@
                 level_str, value);
     fflush(fd);
     axis2_thread_mutex_unlock(mutex);
-
-    return 0;
 }
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_log_debug(axis2_log_t *log, const axis2_char_t *filename,
         const int linenumber, const axis2_char_t *format, ...)
 {
     FILE *fd = NULL;
     axis2_thread_mutex_t *mutex = NULL;
 
-    if (!log || !format)
-        return -1;
-
-    if (!log->enabled)
-        return -1;
-
-    if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
-    {
-        fprintf(stderr, "Stream is not found\n");
-        return -1;
-    }
-
-    if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
-    {
-        fprintf(stderr, "Log mutex is not found\n");
-        return -1;
-    }
-
-    if (AXIS2_LOG_LEVEL_DEBUG <= log->level)
-    {
-        char value[AXIS2_LEN_VALUE+1];
-        va_list ap;
-        va_start(ap, format);
-        AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
-        va_end(ap);
-        axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_DEBUG, filename,
-                linenumber, value);
-    }
-    return 0;
+	 if (log && format && log->enabled)
+		{        
+			 
+			 if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+				{
+					 fprintf(stderr, "Stream is not found\n");
+				}
+
+			 if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+				{
+					 fprintf(stderr, "Log mutex is not found\n");
+					 
+				}
+
+			 if (AXIS2_LOG_LEVEL_DEBUG <= log->level)
+				{
+					 char value[AXIS2_LEN_VALUE+1];
+					 va_list ap;
+					 va_start(ap, format);
+					 AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+					 va_end(ap);
+					 axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_DEBUG, filename,
+															linenumber, value);
+				}
+		}	 
+	 else
+		  fprintf (stderr, "please check your log and buffer");
 }
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_log_info(axis2_log_t *log, const axis2_char_t *format, ...)
 {
     FILE *fd = NULL;
     axis2_thread_mutex_t *mutex = NULL;
 
-    if (!log || !format)
-        return -1;
-
-    if (!log->enabled)
-        return -1;
-
-    if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
-    {
-        fprintf(stderr, "Stream is not found\n");
-        return -1;
-    }
-
-    if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
-    {
-        fprintf(stderr, "Log mutex is not found\n");
-        return -1;
-    }
-
-    if (AXIS2_LOG_LEVEL_INFO <= log->level)
-    {
-        char value[AXIS2_LEN_VALUE+1];
-        va_list ap;
-        va_start(ap, format);
-        AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
-        va_end(ap);
-        axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_INFO, NULL, -1,
-                value);
-    }
-    return 0;
+	 if (log && format && log->enabled)
+		{
+			 if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+				{
+					 fprintf(stderr, "Stream is not found\n");
+					 
+				}
+			 
+			 if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+				{
+					 fprintf(stderr, "Log mutex is not found\n");
+					 
+				}
+			 
+			 if (AXIS2_LOG_LEVEL_INFO <= log->level)
+				{
+					 char value[AXIS2_LEN_VALUE+1];
+					 va_list ap;
+					 va_start(ap, format);
+					 AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+					 va_end(ap);
+					 axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_INFO, NULL, -1,
+															value);
+				}
+		}
+	 else
+		  fprintf (stderr, "please check your log and buffer");
 }
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_log_warning(axis2_log_t *log, const axis2_char_t *filename,
         const int linenumber, const axis2_char_t *format, ...)
 {
     FILE *fd = NULL;
     axis2_thread_mutex_t *mutex = NULL;
 
-    if (!log || !format)
-        return -1;
-
-    if (!log->enabled)
-        return -1;
-
-    if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
-    {
-        fprintf(stderr, "Stream is not found\n");
-        return -1;
-    }
-
-    if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
-    {
-        fprintf(stderr, "Log mutex is not found\n");
-        return -1;
-    }
-
-    if (AXIS2_LOG_LEVEL_WARNING <= log->level)
-    {
-        char value[AXIS2_LEN_VALUE+1];
-        va_list ap;
-        va_start(ap, format);
-        AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
-        va_end(ap);
-        axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_WARNING,
-                filename, linenumber, value);
-    }
-    return 0;
+	 if (log && format && log->enabled)
+		{        
+			 
+			 if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+				{
+					 fprintf(stderr, "Stream is not found\n");
+					 
+				}
+			 
+			 if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+				{
+					 fprintf(stderr, "Log mutex is not found\n");
+					 
+				}
+			 
+			 if (AXIS2_LOG_LEVEL_WARNING <= log->level)
+				{
+					 char value[AXIS2_LEN_VALUE+1];
+					 va_list ap;
+					 va_start(ap, format);
+					 AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+					 va_end(ap);
+					 axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_WARNING,
+															filename, linenumber, value);
+				}
+		}
+	 else
+		  fprintf (stderr, "please check your log and buffer");
 }
 
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_log_error(axis2_log_t *log, const axis2_char_t *filename,
         const int linenumber, const axis2_char_t *format, ...)
 {
@@ -380,34 +374,33 @@
     char value[AXIS2_LEN_VALUE+1];
     va_list ap;
 
-    if (!log || !format)
-        return -1;
-
-    if (!log->enabled)
-        return -1;
-
-    if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
-    {
-        fprintf(stderr, "Stream is not found\n");
-        return -1;
-    }
-
-    if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
-    {
-        fprintf(stderr, "Log mutex is not found\n");
-        return -1;
-    }
-
-
-    va_start(ap, format);
-    AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
-    va_end(ap);
-    axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_ERROR, filename,
-            linenumber, value);
-    return 0;
+	 if (log && format && log->enabled)
+		{
+			 if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+				{
+					 fprintf(stderr, "Stream is not found\n");
+					 
+				}
+			 
+			 if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+				{
+					 fprintf(stderr, "Log mutex is not found\n");
+					 
+				}
+
+
+			 va_start(ap, format);
+			 AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+			 va_end(ap);
+			 axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_ERROR, filename,
+													linenumber, value);
+		}
+	 else
+		  fprintf (stderr, "please check your log and buffer");
+			 
 }
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_log_critical(axis2_log_t *log, const axis2_char_t *filename,
         const int linenumber, const axis2_char_t *format, ...)
 {
@@ -416,31 +409,32 @@
 
     char value[AXIS2_LEN_VALUE+1];
     va_list ap;
-    if (!log || !format)
-        return -1;
-
-    if (!log->enabled)
-        return -1;
-
-    if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
-    {
-        fprintf(stderr, "Stream is not found\n");
-        return -1;
-    }
-
-    if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
-    {
-        fprintf(stderr, "Log mutex is not found\n");
-        return -1;
-    }
 
+	 if (log && format && log->enabled)
+		{        
 
-    va_start(ap, format);
-    AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
-    va_end(ap);
-    axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_CRITICAL, filename,
-            linenumber, value);
-    return 0;
+			 if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+				{
+					 fprintf(stderr, "Stream is not found\n");
+					 
+				}
+			 
+			 if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+				{
+					 fprintf(stderr, "Log mutex is not found\n");
+					 
+				}
+
+
+			 va_start(ap, format);
+			 AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+			 va_end(ap);
+			 axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_CRITICAL, filename,
+													linenumber, value);
+		}
+	 else
+		  fprintf (stderr, "please check your log and buffer");
+    
 }
 
 AXIS2_EXTERN axis2_char_t * AXIS2_CALL
@@ -453,7 +447,6 @@
     if (NULL == time_str)
     {
         return NULL;
-        ;
     }
     if ('\n' == time_str[strlen(time_str)-1])
     {
@@ -462,6 +455,7 @@
     return time_str;
 }
 
+
 AXIS2_EXTERN axis2_log_t * AXIS2_CALL 
 axis2_log_create_default (axis2_allocator_t *allocator)
 {
@@ -496,48 +490,46 @@
 }
 
 #ifdef AXIS2_TRACE
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axis2_log_impl_log_trace(axis2_log_t *log, const axis2_char_t *filename,
         const int linenumber, const axis2_char_t *format, ...)
 {
     FILE *fd = NULL;
     axis2_thread_mutex_t *mutex = NULL;
 
-    if (!log || !format)
-        return -1;
-
-    if (!log->enabled)
-        return -1;
-
-    if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
-    {
-        fprintf(stderr, "Stream is not found\n");
-        return -1;
-    }
-
-    if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
-    {
-        fprintf(stderr, "Log mutex is not found\n");
-        return -1;
-    }
-
-    if (AXIS2_LOG_LEVEL_TRACE <= log->level)
-    {
-        char value[AXIS2_LEN_VALUE+1];
-        va_list ap;
-        va_start(ap, format);
-        AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
-        va_end(ap);
-        axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_TRACE, filename,
-                linenumber, value);
-    }
-    return 0;
+	 if (log && format && log->enabled)
+		{
+			 if (NULL == (fd = AXIS2_INTF_TO_IMPL(log)->stream))
+				{
+					 fprintf(stderr, "Stream is not found\n");
+					 
+				}
+			 
+			 if (NULL == (mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
+				{
+					 fprintf(stderr, "Log mutex is not found\n");
+					 
+				}
+			 
+			 if (AXIS2_LOG_LEVEL_TRACE <= log->level)
+				{
+					 char value[AXIS2_LEN_VALUE+1];
+					 va_list ap;
+					 va_start(ap, format);
+					 AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
+					 va_end(ap);
+					 axis2_log_impl_write_to_file(fd, mutex, AXIS2_LOG_LEVEL_TRACE, filename,
+															linenumber, value);
+				}
+		}
+	 else
+		  fprintf (stderr, "please check your log and buffer");
 }
 #else
-AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_log_impl_log_trace(axis2_log_t *log,
+AXIS2_EXTERN void AXIS2_CALL axis2_log_impl_log_trace(axis2_log_t *log,
         const axis2_char_t *filename, const int linenumber,
         const axis2_char_t *format, ...)
 {
-    return AXIS2_SUCCESS;
+    
 }
 #endif



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org