• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

RecDebug.cc

Go to the documentation of this file.
00001 /** @file
00002 
00003   Record debug and logging
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #include "P_RecUtils.h"
00025 #include "P_RecCore.h"
00026 
00027 static Diags *g_diags = NULL;
00028 
00029 //-------------------------------------------------------------------------
00030 // RecSetDiags
00031 //-------------------------------------------------------------------------
00032 int
00033 RecSetDiags(Diags * _diags)
00034 {
00035   // Warning! It's very dangerous to change diags on the fly!  This
00036   // function only exists so that we can boot-strap TM on startup.
00037   ink_atomic_swap(&g_diags, _diags);
00038   return REC_ERR_OKAY;
00039 }
00040 
00041 
00042 //-------------------------------------------------------------------------
00043 // RecLog
00044 //-------------------------------------------------------------------------
00045 void
00046 RecLog(DiagsLevel dl, const char *format_string, ...)
00047 {
00048   va_list ap;
00049 
00050   va_start(ap, format_string);
00051   if (g_diags) {
00052     g_diags->log_va(NULL, dl, NULL, format_string, ap);
00053   }
00054   va_end(ap);
00055 }
00056 
00057 
00058 //-------------------------------------------------------------------------
00059 // RecDebug
00060 //-------------------------------------------------------------------------
00061 void
00062 RecDebug(DiagsLevel dl, const char *format_string, ...)
00063 {
00064   va_list ap;
00065 
00066   va_start(ap, format_string);
00067   if (g_diags) {
00068     g_diags->log_va("rec", dl, NULL, format_string, ap);
00069   }
00070   va_end(ap);
00071 }
00072 
00073 
00074 //-------------------------------------------------------------------------
00075 // RecDebugOff
00076 //-------------------------------------------------------------------------
00077 void
00078 RecDebugOff()
00079 {
00080   g_diags = NULL;
00081 }

Generated by  doxygen 1.7.1