3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * Artur Szostak <artursz@iafrica.com> *
9 * for The ALICE Off-line Project. *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // global HLT module management //
24 ///////////////////////////////////////////////////////////////////////////////
32 #include "AliL3StandardIncludes.h"
33 #include "AliHLTSystem.h"
34 #include "AliHLTComponentHandler.h"
35 #include "AliHLTComponent.h"
37 ClassImp(AliHLTSystem)
39 char AliHLTSystem::fLogBuffer[LOG_BUFFER_SIZE]="";
41 AliHLTSystem::AliHLTSystem()
43 fpComponentHandler=new AliHLTComponentHandler();
44 if (fpComponentHandler) {
45 AliHLTComponentEnvironment env;
46 memset(&env, 0, sizeof(AliHLTComponentEnvironment));
47 env.fLoggingFunc=AliHLTSystem::Logging;
48 fpComponentHandler->SetEnvironment(&env);
53 AliHLTSystem::~AliHLTSystem()
57 int AliHLTSystem::Logging(void *param, AliHLTComponent_LogSeverity severity, const char* origin, const char* keyword, const char* message) {
59 const char* strSeverity="";
61 case kHLTLogBenchmark:
62 strSeverity="benchmark";
71 strSeverity="warning";
82 cout << "HLT Log " << strSeverity << ": " << origin << " (" << keyword << ") " << message << endl;
86 const char* AliHLTSystem::BuildLogString(const char *format, va_list ap) {
88 int iBufferSize=LOG_BUFFER_SIZE;
89 char* tgtBuffer=fLogBuffer;
92 tgtLen = snprintf(tgtBuffer, iBufferSize, LOG_PREFIX); // add logging prefix
94 tgtBuffer+=tgtLen; iBufferSize-=tgtLen;
95 tgtLen = vsnprintf(tgtBuffer, iBufferSize, format, ap);
98 // if (tgtLen<LOG_BUFFER_SIZE-1) {
99 // *tgtBuffer++='\n'; // add newline if space in buffer
101 *tgtBuffer=0; // terminate the buffer