1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for logging debug, info and error messages //
22 // The AliLog class is a singleton class. It allows to steer the output //
23 // level and output streams for different types of messages via static //
26 // It also handles the messages produces by the preprocessor macros defined //
27 // in the header file: AliDebug, AliInfo, AliWarning, AliError, AliFatal. //
29 // More details about the message logging can be found on the ALICE Offline //
32 ///////////////////////////////////////////////////////////////////////////////
35 #include <Riostream.h>
46 AliLog* AliLog::fgInstance = NULL;
48 Bool_t AliLog::fgDebugEnabled = kTRUE;
51 //_____________________________________________________________________________
54 fGlobalLogLevel(kInfo),
58 // default constructor: set default values
60 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
61 fOutputTypes[iType] = 0;
62 fFileNames[iType] = "";
63 fOutputFiles[iType] = NULL;
64 fOutputStreams[iType] = NULL;
66 fPrintType[iType] = kTRUE;
67 fPrintModule[iType] = kFALSE;
68 fPrintScope[iType] = kTRUE;
69 fPrintLocation[iType] = (iType == kDebug);
72 SetHandleRootMessages(kTRUE);
74 // replace the previous instance by this one
75 if (fgInstance) delete fgInstance;
78 // read the .rootrc settings
82 //_____________________________________________________________________________
85 // destructor: clean up and reset instance pointer
87 for (Int_t i = 0; i < fModuleDebugLevels.GetEntriesFast(); i++) {
88 if (fModuleDebugLevels[i]) fModuleDebugLevels[i]->Delete();
90 fClassDebugLevels.Delete();
91 for (Int_t i = 0; i < fClassDebugLevels.GetEntriesFast(); i++) {
92 if (fClassDebugLevels[i]) fClassDebugLevels[i]->Delete();
94 fClassDebugLevels.Delete();
96 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
105 //_____________________________________________________________________________
106 AliLog::AliLog(const AliLog& log) :
111 Fatal("AliLog", "copy constructor not implemented");
114 //_____________________________________________________________________________
115 AliLog& AliLog::operator = (const AliLog& /*log*/)
117 // assignment operator
119 Fatal("operator =", "assignment operator not implemented");
124 //_____________________________________________________________________________
125 void AliLog::ReadEnvSettings()
127 // load settings from the root configuration file (.rootrc)
128 // and from environment variables
130 static const char* typeNames[kMaxType] =
131 {"kFatal", "kError", "kWarning", "kInfo", "kDebug"};
133 // debug en- or disabling
134 if (gSystem->Getenv("LOG_NO_DEBUG")) {
135 fgDebugEnabled = kFALSE;
136 } else if (gEnv->Defined("AliRoot.AliLog.EnableDebug")) {
137 fgDebugEnabled = gEnv->GetValue("AliRoot.AliLog.EnableDebug",
139 AliInfo(Form("debug %sabled", ((fgDebugEnabled) ? "en" : "dis")));
143 if (gEnv->Defined("AliRoot.AliLog.GlobalLogLevel")) {
144 const char* type = gEnv->GetValue("AliRoot.AliLog.GlobalLogLevel", "");
145 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
146 if (strcmp(type, typeNames[iType]) == 0) fGlobalLogLevel = iType;
148 AliDebug(3, Form("global log level set to %d", fGlobalLogLevel));
151 // global debug level
152 if (gEnv->Defined("AliRoot.AliLog.GlobalDebugLevel")) {
153 Int_t level = gEnv->GetValue("AliRoot.AliLog.GlobalDebugLevel",
154 Int_t(fGlobalLogLevel - kDebugOffset));
155 if (level < -kDebugOffset) level = kDebugOffset;
156 fGlobalLogLevel = kDebugOffset + level;
157 AliDebug(3, Form("global debug level set to %d",
158 fGlobalLogLevel - kDebugOffset));
161 // module debug level
162 if (gEnv->Defined("AliRoot.AliLog.ModuleDebugLevel")) {
163 TString levels = gEnv->GetValue("AliRoot.AliLog.ModuleDebugLevel", "");
164 char* p = const_cast<char*>(levels.Data());
165 while (const char* module = strtok(p, " ")) {
167 char* pos = index(module, ':');
170 Int_t level = atoi(pos);
171 SetModuleDebugLevel(module, level);
172 AliDebug(3, Form("debug level for module %s set to %d", module, level));
177 if (gEnv->Defined("AliRoot.AliLog.ClassDebugLevel")) {
178 TString levels = gEnv->GetValue("AliRoot.AliLog.ClassDebugLevel", "");
179 char* p = const_cast<char*>(levels.Data());
180 while (const char* className = strtok(p, " ")) {
182 char* pos = index(className, ':');
185 Int_t level = atoi(pos);
186 SetClassDebugLevel(className, level);
187 AliDebug(3, Form("debug level for class %s set to %d",
192 // general output stream
193 if (gEnv->Defined("AliRoot.AliLog.Output")) {
194 TString stream = gEnv->GetValue("AliRoot.AliLog.Output", "Standard");
195 if (stream.CompareTo("standard", TString::kIgnoreCase) == 0) {
197 AliDebug(3, "output stream set to standard output for all types");
198 } else if (stream.CompareTo("error", TString::kIgnoreCase) == 0) {
200 AliDebug(3, "output stream set to error output for all types");
201 } else if (!stream.IsNull()) {
202 SetFileOutput(stream);
203 AliDebug(3, Form("output stream set to file %s for all types",
208 // individual output streams
209 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
210 TString name("AliRoot.AliLog.Output.");
211 name += &typeNames[iType][1];
212 if (gEnv->Defined(name)) {
213 TString stream = gEnv->GetValue(name, "Standard");
214 if (stream.CompareTo("standard", TString::kIgnoreCase) == 0) {
215 SetStandardOutput(EType(iType));
216 AliDebug(3, Form("output stream set to standard output for type %s",
218 } else if (stream.CompareTo("error", TString::kIgnoreCase) == 0) {
219 SetErrorOutput(EType(iType));
220 AliDebug(3, Form("output stream set to error output for type %s",
222 } else if (!stream.IsNull()) {
223 SetFileOutput(EType(iType), stream);
224 AliDebug(3, Form("output stream set to file %s for type %s",
225 stream.Data(), typeNames[iType]));
230 // handling of root error messages
231 if (gEnv->Defined("AliRoot.AliLog.HandleRootMessages")) {
232 Bool_t on = gEnv->GetValue("AliRoot.AliLog.HandleRootMessages", kTRUE);
233 SetHandleRootMessages(on);
234 AliDebug(3, Form("handling of root messages %sabled",
235 ((on) ? "en" : "dis")));
239 static const char* settingNames[4] =
240 {"Type", "Module", "Scope", "Location"};
242 {fPrintType, fPrintModule, fPrintScope, fPrintLocation};
243 for (Int_t iSetting = 0; iSetting < 4; iSetting++) {
244 TString name("AliRoot.AliLog.Print");
245 name += settingNames[iSetting];
246 if (gEnv->Defined(name)) {
247 Bool_t on = gEnv->GetValue(name, settings[iSetting][0]);
248 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
249 settings[iSetting][iType] = on;
251 AliDebug(3, Form("printing of %s %sabled for all types",
252 settingNames[iSetting], ((on) ? "en" : "dis")));
255 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
256 TString nameType = name + "." + &typeNames[iType][1];
257 if (gEnv->Defined(nameType)) {
258 Bool_t on = gEnv->GetValue(nameType, settings[iSetting][iType]);
259 settings[iSetting][iType] = on;
260 AliDebug(3, Form("printing of %s %sabled for type %s",
261 settingNames[iSetting], ((on) ? "en" : "dis"),
269 //_____________________________________________________________________________
270 void AliLog::RootErrorHandler(Int_t level, Bool_t abort,
271 const char* location, const char* message)
273 // new error handler for messages from root
276 case ::kFatal : level = kFatal; break;
278 DefaultErrorHandler(level, abort, location, message);
281 DefaultErrorHandler(level, abort, location, message);
283 case ::kError : level = kError; break;
284 case ::kWarning : level = kWarning; break;
285 case ::kInfo : level = kInfo; break;
286 default : level = kDebug; break;
288 AliLog::Message(level, message, "ROOT", NULL, location, NULL, 0);
292 //_____________________________________________________________________________
293 void AliLog::EnableDebug(Bool_t enabled)
295 // enable or disable debug output
297 fgDebugEnabled = enabled;
300 //_____________________________________________________________________________
301 void AliLog::SetGlobalLogLevel(EType type)
303 // set the global debug level
305 if (!fgInstance) new AliLog;
306 fgInstance->fGlobalLogLevel = type;
309 //_____________________________________________________________________________
310 Int_t AliLog::GetGlobalLogLevel()
312 // get the global debug level
314 if (!fgInstance) new AliLog;
315 return fgInstance->fGlobalLogLevel;
318 //_____________________________________________________________________________
319 void AliLog::SetGlobalDebugLevel(Int_t level)
321 // set the global debug level
323 if (!fgInstance) new AliLog;
324 if (level < -kDebugOffset) level = -kDebugOffset;
325 fgInstance->fGlobalLogLevel = kDebugOffset + level;
328 //_____________________________________________________________________________
329 Int_t AliLog::GetGlobalDebugLevel()
331 // get the global debug level
333 if (!fgInstance) new AliLog;
334 return fgInstance->fGlobalLogLevel - kDebugOffset;
337 //_____________________________________________________________________________
338 void AliLog::SetModuleDebugLevel(const char* module, Int_t level)
340 // set the debug level for the given module
343 if (!fgInstance) new AliLog;
344 TObject* obj = fgInstance->fModuleDebugLevels.FindObject(module);
346 obj = new TNamed(module, module);
347 fgInstance->fModuleDebugLevels.Add(obj);
349 level += kDebugOffset;
350 if (level < kFatal) level = kFatal;
351 obj->SetUniqueID(level);
354 //_____________________________________________________________________________
355 void AliLog::ClearModuleDebugLevel(const char* module)
357 // remove the setting of the debug level for the given module
360 if (!fgInstance) new AliLog;
361 TObject* obj = fgInstance->fModuleDebugLevels.FindObject(module);
362 if (obj) delete fgInstance->fModuleDebugLevels.Remove(obj);
365 //_____________________________________________________________________________
366 void AliLog::SetClassDebugLevel(const char* className, Int_t level)
368 // set the debug level for the given class
370 if (!className) return;
371 if (!fgInstance) new AliLog;
372 TObject* obj = fgInstance->fClassDebugLevels.FindObject(className);
374 obj = new TNamed(className, className);
375 fgInstance->fClassDebugLevels.Add(obj);
377 level += kDebugOffset;
378 if (level < kFatal) level = kFatal;
379 obj->SetUniqueID(level);
382 //_____________________________________________________________________________
383 void AliLog::ClearClassDebugLevel(const char* className)
385 // remove the setting of the debug level for the given class
387 if (!className) return;
388 if (!fgInstance) new AliLog;
389 TObject* obj = fgInstance->fClassDebugLevels.FindObject(className);
390 if (obj) delete fgInstance->fClassDebugLevels.Remove(obj);
394 //_____________________________________________________________________________
395 void AliLog::SetStandardOutput()
397 // write all log messages to the standard output (stdout)
399 if (!fgInstance) new AliLog;
400 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
401 fgInstance->CloseFile(iType);
402 fgInstance->fOutputTypes[iType] = 0;
406 //_____________________________________________________________________________
407 void AliLog::SetStandardOutput(EType type)
409 // write log messages of the given type to the standard output (stdout)
411 if ((type < kFatal) || (type >= kMaxType)) return;
412 if (!fgInstance) new AliLog;
413 fgInstance->CloseFile(type);
414 fgInstance->fOutputTypes[type] = 0;
417 //_____________________________________________________________________________
418 void AliLog::SetErrorOutput()
420 // write all log messages to the error output (stderr)
422 if (!fgInstance) new AliLog;
423 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
424 fgInstance->CloseFile(iType);
425 fgInstance->fOutputTypes[iType] = 1;
429 //_____________________________________________________________________________
430 void AliLog::SetErrorOutput(EType type)
432 // write log messages of the given type to the error output (stderr)
434 if ((type < kFatal) || (type >= kMaxType)) return;
435 if (!fgInstance) new AliLog;
436 fgInstance->CloseFile(type);
437 fgInstance->fOutputTypes[type] = 1;
440 //_____________________________________________________________________________
441 void AliLog::SetFileOutput(const char* fileName)
443 // write all log messages to the given file
445 if (!fgInstance) new AliLog;
446 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
447 if ((fgInstance->fOutputTypes[iType] == 2) &&
448 (fgInstance->fFileNames[iType].CompareTo(fileName) != 0)) {
449 fgInstance->CloseFile(iType);
451 fgInstance->fOutputTypes[iType] = 2;
452 fgInstance->fFileNames[iType] = fileName;
453 fgInstance->fOutputFiles[iType] = NULL;
454 fgInstance->fOutputStreams[iType] = NULL;
458 //_____________________________________________________________________________
459 void AliLog::SetFileOutput(EType type, const char* fileName)
461 // write log messages of the given type to the given file
463 if ((type < kFatal) || (type >= kMaxType)) return;
464 if (!fgInstance) new AliLog;
465 if ((fgInstance->fOutputTypes[type] == 2) &&
466 (fgInstance->fFileNames[type].CompareTo(fileName) != 0)) {
467 fgInstance->CloseFile(type);
469 fgInstance->fOutputTypes[type] = 2;
470 fgInstance->fFileNames[type] = fileName;
471 fgInstance->fOutputFiles[type] = NULL;
472 fgInstance->fOutputStreams[type] = NULL;
475 //_____________________________________________________________________________
476 void AliLog::CloseFile(Int_t type)
478 // close the file for the given type if needed
480 if ((fOutputTypes[type] == 2) && fOutputFiles[type]) {
481 Bool_t closeFile = kTRUE;
482 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
483 if ((iType != type) && (fOutputFiles[iType] == fOutputFiles[type])) {
488 fclose(fOutputFiles[type]);
489 fOutputStreams[type]->close();
490 delete fOutputStreams[type];
493 fOutputFiles[type] = NULL;
494 fOutputStreams[type] = NULL;
495 fFileNames[type] = "";
496 fOutputTypes[type] = 0;
499 //_____________________________________________________________________________
500 FILE* AliLog::GetOutputStream(Int_t type)
502 // get the output stream for the given type of messages
504 if (type > kDebug) type = kDebug;
505 if (fOutputTypes[type] == 0) return stdout;
506 else if (fOutputTypes[type] == 1) return stderr;
507 else if (fOutputTypes[type] == 2) {
508 if (!fOutputFiles[type]) {
510 ofstream* stream = NULL;
511 if (!fFileNames[type].IsNull()) {
512 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
513 if ((iType != type) &&
514 (fFileNames[iType].CompareTo(fFileNames[type]) == 0) &&
515 fOutputFiles[iType]) {
516 file = fOutputFiles[iType];
517 stream = fOutputStreams[iType];
522 file = fopen(fFileNames[type], "a");
523 stream = new ofstream(fFileNames[type], ios::app);
526 fOutputFiles[type] = file;
527 fOutputStreams[type] = stream;
528 if (!file) CloseFile(type);
530 if (fOutputFiles[type]) return fOutputFiles[type];
536 //_____________________________________________________________________________
539 // flush the output streams
541 if (!fgInstance) new AliLog;
542 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
543 if (fgInstance->fOutputFiles[iType]) {
544 fflush(fgInstance->fOutputFiles[iType]);
545 fgInstance->fOutputStreams[iType]->flush();
553 //_____________________________________________________________________________
554 void AliLog::SetHandleRootMessages(Bool_t on)
556 // enable or disable the handling of messages form root
559 SetErrorHandler(RootErrorHandler);
561 SetErrorHandler(DefaultErrorHandler);
566 //_____________________________________________________________________________
567 void AliLog::SetPrintType(Bool_t on)
569 // switch on or off the printing of the message type for all message types
571 if (!fgInstance) new AliLog;
572 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
573 fgInstance->fPrintType[iType] = on;
577 //_____________________________________________________________________________
578 void AliLog::SetPrintType(EType type, Bool_t on)
580 // switch on or off the printing of the message type for the given message type
582 if ((type < kFatal) || (type >= kMaxType)) return;
583 if (!fgInstance) new AliLog;
584 fgInstance->fPrintType[type] = on;
587 //_____________________________________________________________________________
588 void AliLog::SetPrintModule(Bool_t on)
590 // switch on or off the printing of the module for all message types
592 if (!fgInstance) new AliLog;
593 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
594 fgInstance->fPrintModule[iType] = on;
598 //_____________________________________________________________________________
599 void AliLog::SetPrintModule(EType type, Bool_t on)
601 // switch on or off the printing of the module for the given message type
603 if ((type < kFatal) || (type >= kMaxType)) return;
604 if (!fgInstance) new AliLog;
605 fgInstance->fPrintModule[type] = on;
608 //_____________________________________________________________________________
609 void AliLog::SetPrintScope(Bool_t on)
611 // switch on or off the printing of the scope/class name for all message types
613 if (!fgInstance) new AliLog;
614 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
615 fgInstance->fPrintScope[iType] = on;
619 //_____________________________________________________________________________
620 void AliLog::SetPrintScope(EType type, Bool_t on)
622 // switch on or off the printing of the scope/class name
623 // for the given message type
625 if ((type < kFatal) || (type >= kMaxType)) return;
626 if (!fgInstance) new AliLog;
627 fgInstance->fPrintScope[type] = on;
630 //_____________________________________________________________________________
631 void AliLog::SetPrintLocation(Bool_t on)
633 // switch on or off the printing of the file name and line number
634 // for all message types
636 if (!fgInstance) new AliLog;
637 for (Int_t iType = kFatal; iType < kMaxType; iType++) {
638 fgInstance->fPrintLocation[iType] = on;
642 //_____________________________________________________________________________
643 void AliLog::SetPrintLocation(EType type, Bool_t on)
645 // switch on or off the printing of the file name and line number
646 // for the given message type
648 if ((type < kFatal) || (type >= kMaxType)) return;
649 if (!fgInstance) new AliLog;
650 fgInstance->fPrintLocation[type] = on;
654 //_____________________________________________________________________________
655 void AliLog::Write(const char* name, Int_t option)
657 // write the log object with the given name and option to the current file
659 if (!fgInstance) new AliLog;
660 fgInstance->TObject::Write(name, option);
664 //_____________________________________________________________________________
665 UInt_t AliLog::GetLogLevel(const char* module, const char* className) const
667 // get the logging level for the given module and class
669 if (!fgInstance) new AliLog;
670 TObject* obj = fgInstance->fClassDebugLevels.FindObject(className);
671 if (obj) return obj->GetUniqueID();
672 obj = fgInstance->fModuleDebugLevels.FindObject(module);
673 if (obj) return obj->GetUniqueID();
674 return fgInstance->fGlobalLogLevel;
677 //_____________________________________________________________________________
678 Int_t AliLog::GetDebugLevel(const char* module, const char* className)
680 // get the debug level for the given module and class
682 if (!fgInstance) new AliLog;
683 return fgInstance->GetLogLevel(module, className) - kDebugOffset;
686 //_____________________________________________________________________________
687 void AliLog::PrintMessage(UInt_t type, const char* message,
688 const char* module, const char* className,
689 const char* function, const char* file, Int_t line)
691 // print the given message
693 FILE* stream = GetOutputStream(type);
694 static const char* typeNames[kMaxType] =
695 {"Fatal", "Error", "Warning", "Info", "Debug"};
697 if (fPrintType[type]) {
698 fprintf(stream, "%s in ", typeNames[type]);
700 fprintf(stream, "<");
701 if (fPrintModule[type] && module) {
702 fprintf(stream, "%s/", module);
704 if (fPrintScope[type] && className) {
705 fprintf(stream, "%s::", className);
708 fprintf(stream, "%s>: %s", function, message);
710 fprintf(stream, "%s>", function);
712 if (fPrintLocation[type] && file) {
713 fprintf(stream, " (%s:%.0d)", file, line);
716 fprintf(stream, "\n");
718 fprintf(stream, ": ");
722 //_____________________________________________________________________________
723 void AliLog::Message(UInt_t level, const char* message,
724 const char* module, const char* className,
725 const char* function, const char* file, Int_t line)
727 // print a log message
729 if (!fgInstance) new AliLog;
731 // get the message type
733 if (type >= kMaxType) type = kMaxType - 1;
735 // print the message if the debug level allows
736 if (level <= fgInstance->GetLogLevel(module, className)) {
737 fgInstance->PrintMessage(type, message,
738 module, className, function, file, line);
741 // abort in case of a fatal message
742 if (type == kFatal) {
745 gSystem->StackTrace();
753 //_____________________________________________________________________________
754 void AliLog::Debug(UInt_t level, const char* message,
755 const char* module, const char* className,
756 const char* function, const char* file, Int_t line)
758 // print a debug message
760 if (level == 0) level = 1;
761 level += kDebugOffset;
762 Message(level, message, module, className, function, file, line);
766 //_____________________________________________________________________________
767 Int_t AliLog::RedirectStdoutTo(EType type, UInt_t level, const char* module,
768 const char* className, const char* function,
769 const char* file, Int_t line, Bool_t print)
771 // redirect the standard output to the stream of the given type
773 if (!fgInstance) new AliLog;
774 return fgInstance->RedirectTo(stdout, type, level, module, className,
775 function, file, line, print);
778 //_____________________________________________________________________________
779 Int_t AliLog::RedirectStderrTo(EType type, UInt_t level, const char* module,
780 const char* className, const char* function,
781 const char* file, Int_t line, Bool_t print)
783 // redirect the standard error output to the stream of the given type
785 if (!fgInstance) new AliLog;
786 return fgInstance->RedirectTo(stderr, type, level, module, className,
787 function, file, line, print);
790 //_____________________________________________________________________________
791 Int_t AliLog::RedirectTo(FILE* stream, EType type, UInt_t level,
792 const char* module, const char* className,
793 const char* function, const char* file, Int_t line,
796 // redirect the standard (error) output stream to the stream of the given type
798 // get the original file descriptor to be able to restore it later
799 Int_t original = dup(fileno(stream));
802 // flush the stream of the selected type
803 FILE* newStream = GetOutputStream(type);
807 if ((type == kDebug) && (level > 0)) level--;
808 if (type + level > GetLogLevel(module, className)) { // /dev/null
809 freopen("/dev/null", "a", stream);
810 } else if (fOutputTypes[type] == 0) { // stdout
811 if (stream != stdout) dup2(fileno(stdout), fileno(stream));
812 } else if (fOutputTypes[type] == 1) { // stderr
813 if (stream != stderr) dup2(fileno(stderr), fileno(stream));
814 } else if (fOutputTypes[type] == 2) { // file
815 freopen(fFileNames[type], "a", stream);
820 PrintMessage(type, NULL, module, className, function, file, line);
827 //_____________________________________________________________________________
828 void AliLog::RestoreStdout(Int_t original)
830 // restore the standard output
833 dup2(original, fileno(stdout));
836 //_____________________________________________________________________________
837 void AliLog::RestoreStderr(Int_t original)
839 // restore the standard error output
842 dup2(original, fileno(stderr));
846 //_____________________________________________________________________________
847 ostream& AliLog::Stream(EType type, UInt_t level,
848 const char* module, const char* className,
849 const char* function, const char* file, Int_t line)
851 // get the stream object for the given output type
853 if (!fgInstance) new AliLog;
854 return fgInstance->GetStream(type, level, module, className,
855 function, file, line);
858 //_____________________________________________________________________________
859 ostream& AliLog::GetStream(EType type, UInt_t level,
860 const char* module, const char* className,
861 const char* function, const char* file, Int_t line)
863 // get the stream object for the given output type
865 if ((type == kDebug) && (level > 0)) level--;
866 Bool_t noOutput = (type + level > GetLogLevel(module, className));
869 PrintMessage(type, NULL, module, className, function, file, line);
871 fflush(GetOutputStream(type));
873 static ofstream nullStream("/dev/null");
876 } else if (fOutputTypes[type] == 0) {
878 } else if (fOutputTypes[type] == 1) {
880 } else if (fOutputTypes[type] == 2) {
881 return *fOutputStreams[type];