Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afsadmsvr / TaAfsAdmSvrDebug.cpp
blob31d23798f8e9e73015b19e6decc415e366d21973
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "TaAfsAdmSvrInternal.h"
22 * VARIABLES __________________________________________________________________
26 static DWORD PrintDetailLevel = dlDEFAULT;
30 * ROUTINES ___________________________________________________________________
34 void cdecl vPrint (DWORD level, LPTSTR pszLine, va_list arg)
36 static LPCRITICAL_SECTION pcs = NULL;
37 if (!pcs)
39 pcs = New (CRITICAL_SECTION);
40 InitializeCriticalSection (pcs);
43 EnterCriticalSection (pcs);
45 if ((!level) || (PrintDetailLevel & level))
47 TCHAR szOut[ 1024 ];
48 wvsprintf (szOut, pszLine, arg);
49 printf ("AdmSvr: ");
50 if (!level)
51 printf (" * ");
52 if (level & dlINDENT1)
53 printf (" ");
54 if (level & dlINDENT2)
55 printf (" ");
56 printf ("%s\n", szOut);
59 LeaveCriticalSection (pcs);
63 void cdecl Print (LPTSTR pszLine, ...)
65 va_list arg;
66 va_start (arg, pszLine);
67 vPrint (dlSTANDARD, pszLine, arg);
71 void cdecl Print (DWORD level, LPTSTR pszLine, ...)
73 va_list arg;
74 va_start (arg, pszLine);
75 vPrint (level, pszLine, arg);
79 DWORD GetPrintDetailLevel (void)
81 return PrintDetailLevel;
85 void SetPrintDetailLevel (DWORD level)
87 PrintDetailLevel = level;