xref: /onnv-gate/usr/src/lib/udapl/udapl_tavor/common/dapl_debug.c (revision 9517:b4839b0aa7a4)
1*9517SBill.Taylor@Sun.COM /*
2*9517SBill.Taylor@Sun.COM  * CDDL HEADER START
3*9517SBill.Taylor@Sun.COM  *
4*9517SBill.Taylor@Sun.COM  * The contents of this file are subject to the terms of the
5*9517SBill.Taylor@Sun.COM  * Common Development and Distribution License (the "License").
6*9517SBill.Taylor@Sun.COM  * You may not use this file except in compliance with the License.
7*9517SBill.Taylor@Sun.COM  *
8*9517SBill.Taylor@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9517SBill.Taylor@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*9517SBill.Taylor@Sun.COM  * See the License for the specific language governing permissions
11*9517SBill.Taylor@Sun.COM  * and limitations under the License.
12*9517SBill.Taylor@Sun.COM  *
13*9517SBill.Taylor@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*9517SBill.Taylor@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9517SBill.Taylor@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*9517SBill.Taylor@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*9517SBill.Taylor@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9517SBill.Taylor@Sun.COM  *
19*9517SBill.Taylor@Sun.COM  * CDDL HEADER END
20*9517SBill.Taylor@Sun.COM  */
21*9517SBill.Taylor@Sun.COM 
22*9517SBill.Taylor@Sun.COM /*
23*9517SBill.Taylor@Sun.COM  * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24*9517SBill.Taylor@Sun.COM  */
25*9517SBill.Taylor@Sun.COM 
26*9517SBill.Taylor@Sun.COM /*
27*9517SBill.Taylor@Sun.COM  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*9517SBill.Taylor@Sun.COM  * Use is subject to license terms.
29*9517SBill.Taylor@Sun.COM  */
30*9517SBill.Taylor@Sun.COM 
31*9517SBill.Taylor@Sun.COM #include "dapl_debug.h"
32*9517SBill.Taylor@Sun.COM #include "dapl.h"
33*9517SBill.Taylor@Sun.COM #include <stdarg.h>
34*9517SBill.Taylor@Sun.COM #include <stdlib.h>
35*9517SBill.Taylor@Sun.COM 
36*9517SBill.Taylor@Sun.COM #ifdef DAPL_DBG
37*9517SBill.Taylor@Sun.COM DAPL_DBG_TYPE g_dapl_dbg_type;		/* initialized in dapl_init.c */
38*9517SBill.Taylor@Sun.COM DAPL_DBG_DEST g_dapl_dbg_dest;		/* initialized in dapl_init.c */
39*9517SBill.Taylor@Sun.COM 
40*9517SBill.Taylor@Sun.COM void
dapl_internal_dbg_log(DAPL_DBG_TYPE type,const char * fmt,...)41*9517SBill.Taylor@Sun.COM dapl_internal_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...)
42*9517SBill.Taylor@Sun.COM {
43*9517SBill.Taylor@Sun.COM 	va_list		args;
44*9517SBill.Taylor@Sun.COM 
45*9517SBill.Taylor@Sun.COM 	if (type & g_dapl_dbg_type) {
46*9517SBill.Taylor@Sun.COM 		va_start(args, fmt);
47*9517SBill.Taylor@Sun.COM 
48*9517SBill.Taylor@Sun.COM 		if (DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest) {
49*9517SBill.Taylor@Sun.COM 			(void) dapl_os_vprintf(fmt, args);
50*9517SBill.Taylor@Sun.COM 		}
51*9517SBill.Taylor@Sun.COM 
52*9517SBill.Taylor@Sun.COM 		if (DAPL_DBG_DEST_SYSLOG & g_dapl_dbg_dest) {
53*9517SBill.Taylor@Sun.COM 			dapl_os_syslog(fmt, args);
54*9517SBill.Taylor@Sun.COM 		}
55*9517SBill.Taylor@Sun.COM 		va_end(args);
56*9517SBill.Taylor@Sun.COM 	}
57*9517SBill.Taylor@Sun.COM }
58*9517SBill.Taylor@Sun.COM #endif
59