You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/11/09 06:36:41 UTC
svn commit: r331957 - in /webservices/axis2/trunk/c: include/axis2_env.h
modules/util/src/env.c
Author: samisa
Date: Tue Nov 8 21:36:32 2005
New Revision: 331957
URL: http://svn.apache.org/viewcvs?rev=331957&view=rev
Log:
Added logging stuff
Modified:
webservices/axis2/trunk/c/include/axis2_env.h
webservices/axis2/trunk/c/modules/util/src/env.c
Modified: webservices/axis2/trunk/c/include/axis2_env.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_env.h?rev=331957&r1=331956&r2=331957&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_env.h (original)
+++ webservices/axis2/trunk/c/include/axis2_env.h Tue Nov 8 21:36:32 2005
@@ -121,12 +121,18 @@
/**
* Enables logging
*/
- AXIS2_DECLARE(axis2_status_t) axis2_env_enable_log (axis2_env_t *env, axis2_bool_t enable);
+ AXIS2_DECLARE(axis2_status_t) axis2_env_enable_log (axis2_env_t **env, axis2_bool_t enable);
/**
- *
+ * Checks the status code of environment
*/
- AXIS2_DECLARE(axis2_status_t) axis2_env_check_status (axis2_env_t *env);
+ AXIS2_DECLARE(axis2_status_t) axis2_env_check_status (axis2_env_t **env);
+
+ /**
+ * Writes given message to the log
+ */
+ AXIS2_DECLARE(axis2_status_t) axis2_env_write_log (axis2_env_t **env, const char* message);
+ #define AXIS2_LOG(env, message) axis2_env_write_log (env,message)
#define AXIS2_ENV_CHECK(env, error_return) \
if(!env || !(*env)) \
Modified: webservices/axis2/trunk/c/modules/util/src/env.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/env.c?rev=331957&r1=331956&r2=331957&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/env.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/env.c Tue Nov 8 21:36:32 2005
@@ -18,8 +18,9 @@
#include <axis2_env.h>
#include <axis2_error_default.h>
+#include <axis2_string.h>
-AXIS2_DECLARE(axis2_status_t) axis2_env_free (axis2_env_t *env)
+axis2_status_t AXIS2_CALL axis2_env_free (axis2_env_t *env)
{
if(NULL != env && NULL != env->allocator)
free (env->allocator);
@@ -39,7 +40,7 @@
return 0;
}
-AXIS2_DECLARE(axis2_env_t *)
+axis2_env_t* AXIS2_CALL
axis2_env_create (axis2_allocator_t *allocator)
{
axis2_env_t *environment;
@@ -63,7 +64,7 @@
}
-AXIS2_DECLARE(axis2_env_t *)
+axis2_env_t* AXIS2_CALL
axis2_env_create_with_error_stream (axis2_allocator_t *allocator
, axis2_error_t *error, axis2_stream_t *stream)
{
@@ -71,7 +72,7 @@
, stream, NULL);
}
-AXIS2_DECLARE(axis2_env_t *)
+axis2_env_t * AXIS2_CALL
axis2_env_create_with_error_stream_log (axis2_allocator_t *allocator
, axis2_error_t *error, axis2_stream_t *stream
, axis2_log_t *log)
@@ -107,11 +108,32 @@
axis2_status_t AXIS2_CALL
-axis2_env_check_status (axis2_env_t *env)
+axis2_env_check_status (axis2_env_t **env)
{
- if(NULL == env)
+ AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+
+ return AXIS2_ERROR_GET_STATUS_CODE((*env)->error);
+}
+
+axis2_status_t AXIS2_CALL axis2_env_enable_log (axis2_env_t **env, axis2_bool_t enable)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+
+ (*env)->log_enabled = enable;
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL axis2_env_write_log (axis2_env_t **env, const char* message)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+
+ if (! ((*env)->log_enabled))
+ return AXIS2_SUCCESS;
+
+ if (message && (*env)->log)
{
- AXIS2_ENV_CHECK(&env, AXIS2_CRTICAL_FAILURE);
+ AXIS2_LOG_WRITE((*env)->log, message, strlen(message) );
}
- return AXIS2_ERROR_GET_STATUS_CODE(env->error);
+ return AXIS2_SUCCESS;
}