celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bjoern Petri <bjoern.pe...@sundevil.de>
Subject RE: svn commit: r1640622 - /celix/trunk/log_service/public/src/log_helper.c
Date Wed, 19 Nov 2014 20:40:18 GMT

Nowhere. I just replaced it.

On 2014-11-19 21:29, Daniel Parker wrote:
> Where is CELIX_LOG_ENABLE_STDOUT_FALLBACK_PROPERTY_NAME declared?
> 
> Daniel Parker
> 
> -----Original Message-----
> From: bpetri@apache.org [mailto:bpetri@apache.org]
> Sent: Wednesday, November 19, 2014 14:45
> To: commits@celix.apache.org
> Subject: svn commit: r1640622 - 
> /celix/trunk/log_service/public/src/log_helper.c
> 
> Author: bpetri
> Date: Wed Nov 19 19:45:21 2014
> New Revision: 1640622
> 
> URL: http://svn.apache.org/r1640622
> Log:
> CELIX-182: add property to enable stdout print fallback when
> log_service is not available
> 
> Modified:
>     celix/trunk/log_service/public/src/log_helper.c
> 
> Modified: celix/trunk/log_service/public/src/log_helper.c
> URL:
> http://svn.apache.org/viewvc/celix/trunk/log_service/public/src/log_helper.c?rev=1640622&r1=1640621&r2=1640622&view=diff
> ==============================================================================
> --- celix/trunk/log_service/public/src/log_helper.c (original)
> +++ celix/trunk/log_service/public/src/log_helper.c Wed Nov 19 19:45:21
> +++ 2014
> @@ -1,8 +1,32 @@
> +/**
> + *Licensed to the Apache Software Foundation (ASF) under one  *or more
> +contributor license agreements.  See the NOTICE file  *distributed 
> with
> +this work for additional information  *regarding copyright ownership.
> +The ASF licenses this file  *to you under the Apache License, Version
> +2.0 (the  *"License"); you may not use this file except in compliance
> +*with the License.  You may obtain a copy of the License at
> + *
> + *  http://www.apache.org/licenses/LICENSE-2.0
> + *
> + *Unless required by applicable law or agreed to in writing,  
> *software
> +distributed under the License is distributed on an  *"AS IS" BASIS,
> +WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the  
> *specific
> +language governing permissions and limitations  *under the License.
> + */
> +/*
> + * log_helper.c
> + *
> + *  \date       Nov 10, 2014
> + *  \author     <a
> href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
> Team</a>
> + *  \copyright  Apache License, Version 2.0  */
> 
>  #include <stdlib.h>
>  #include <stdarg.h>
> 
> -
>  #include "bundle_context.h"
>  #include "service_tracker.h"
>  #include "celix_threads.h"
> @@ -13,11 +37,15 @@
> 
>  #include "log_helper.h"
> 
> +#define LOGHELPER_ENABLE_STDOUT_FALLBACK_PROPERTY_NAME
> 	"LOGHELPER_ENABLE_STDOUT_FALLBACK"
> +
> +
>  struct log_helper {
>  	bundle_context_pt bundleContext;
>      service_tracker_pt logServiceTracker;
>  	celix_thread_mutex_t logListLock;
>  	array_list_pt logServices;
> +	bool stdOutFallback;
>  };
> 
>  celix_status_t logHelper_logServiceAdded(void *handle,
> service_reference_pt reference, void *service); @@ -36,8 +64,16 @@
> celix_status_t logHelper_create(bundle_c
>  	}
>  	else
>  	{
> +		char* stdOutFallbackStr = NULL;
>  		(*loghelper)->bundleContext = context;
>  		(*loghelper)->logServiceTracker = NULL;
> +		(*loghelper)->stdOutFallback = false;
> +
> +		bundleContext_getProperty(context,
> +CELIX_LOG_ENABLE_STDOUT_FALLBACK_PROPERTY_NAME, &stdOutFallbackStr);
> +
> +		if (stdOutFallbackStr != NULL) {
> +			(*loghelper)->stdOutFallback = true;
> +		}
> 
>  		pthread_mutex_init(&(*loghelper)->logListLock, NULL);
>          arrayList_create(&(*loghelper)->logServices);
> @@ -145,7 +181,7 @@ celix_status_t logHelper_log(log_helper_
>  	}
> 
> 
> -    if (!logged) {
> +    if (!logged && loghelper->stdOutFallback) {
>          char *levelStr = NULL;
> 
>          switch (level) {

Mime
View raw message