The Gaudi Framework
v41r0 (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
ColorMsgAlg.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include "
ColorMsgAlg.h
"
12
#include <
GaudiKernel/ISvcLocator.h
>
13
#include <
GaudiKernel/MsgStream.h
>
14
15
// Static Factory declaration
16
17
DECLARE_COMPONENT
(
ColorMsgAlg
)
18
19
20
21
ColorMsgAlg
::
ColorMsgAlg
( const
std
::
string
&
name
,
ISvcLocator
* pSvcLocator ) :
Algorithm
(
name
, pSvcLocator ) {}
22
23
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25
StatusCode
ColorMsgAlg::initialize
() {
return
StatusCode::SUCCESS
; }
26
27
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29
StatusCode
ColorMsgAlg::execute
() {
30
31
auto
& log =
msgStream
();
32
33
log <<
MSG::FATAL
<<
"THIS IS A FATAL MESSAGE"
<<
endmsg
;
34
log <<
MSG::ERROR
<<
"THIS IS AN ERROR MESSAGE"
<<
endmsg
;
35
log <<
MSG::WARNING
<<
"THIS IS A WARNING MESSAGE"
<<
endmsg
;
36
log <<
MSG::INFO
<<
"THIS IS A INFO MESSAGE"
<<
endmsg
;
37
log <<
MSG::DEBUG
<<
"THIS IS A DEBUG MESSAGE"
<<
endmsg
;
38
log <<
MSG::VERBOSE
<<
"THIS IS A VERBOSE MESSAGE"
<<
endmsg
;
39
40
log <<
MSG::ERROR
<<
"this is another"
;
41
log.setColor(
MSG::GREEN
);
42
log <<
" error "
;
43
log.resetColor();
44
log <<
"message"
<<
endmsg
;
45
46
log <<
MSG::WARNING
<<
"This is another"
;
47
log.setColor(
MSG::PURPLE
);
48
log <<
" warning "
;
49
log.resetColor();
50
log <<
"message"
<<
endmsg
;
51
52
log <<
MSG::INFO
<<
"testing colour"
<<
endmsg
;
53
54
log <<
MSG::INFO
<<
"setting...."
;
55
log.setColor(
MSG::YELLOW
);
56
log <<
"this should be in yellow"
;
57
log.setColor(
MSG::RED
);
58
log <<
" and red"
;
59
// log.setColor(MSG::U1);
60
// log << "/n this should be in unknown";
61
log <<
endmsg
;
62
63
log <<
MSG::INFO
<<
"multicolor: "
;
64
log.setColor(
MSG::BLUE
,
MSG::GREEN
);
65
log <<
"this is blue on green"
;
66
log.setColor(
MSG::PURPLE
,
MSG::WHITE
);
67
log <<
" and purple on white"
<<
endmsg
;
68
69
log.setColor(
MSG::GREEN
);
70
log <<
MSG::INFO
<<
"This is green. "
;
71
log.setColor(
MSG::YELLOW
,
MSG::BLUE
);
72
log <<
"This is in yellow on blue. "
;
73
log.resetColor();
74
log <<
"This is back to normal"
<<
endmsg
;
75
76
return
StatusCode::SUCCESS
;
77
}
78
79
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
80
81
StatusCode
ColorMsgAlg::finalize
() {
return
StatusCode::SUCCESS
; }
ColorMsgAlg.h
ISvcLocator.h
MsgStream.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
ColorMsgAlg
Definition
ColorMsgAlg.h:21
ColorMsgAlg::finalize
StatusCode finalize() override
Definition
ColorMsgAlg.cpp:81
ColorMsgAlg::execute
StatusCode execute() override
Definition
ColorMsgAlg.cpp:29
ColorMsgAlg::ColorMsgAlg
ColorMsgAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ColorMsgAlg.cpp:21
ColorMsgAlg::initialize
StatusCode initialize() override
Definition
ColorMsgAlg.cpp:25
CommonMessagingBase::msgStream
MsgStream & msgStream() const
Return an uninitialized MsgStream.
Definition
CommonMessaging.h:82
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition
Algorithm.h:98
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:518
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
MSG::GREEN
@ GREEN
Definition
IMessageSvc.h:23
MSG::WHITE
@ WHITE
Definition
IMessageSvc.h:23
MSG::YELLOW
@ YELLOW
Definition
IMessageSvc.h:23
MSG::PURPLE
@ PURPLE
Definition
IMessageSvc.h:23
MSG::BLUE
@ BLUE
Definition
IMessageSvc.h:23
MSG::RED
@ RED
Definition
IMessageSvc.h:23
MSG::WARNING
@ WARNING
Definition
IMessageSvc.h:22
MSG::FATAL
@ FATAL
Definition
IMessageSvc.h:22
MSG::DEBUG
@ DEBUG
Definition
IMessageSvc.h:22
MSG::ERROR
@ ERROR
Definition
IMessageSvc.h:22
MSG::INFO
@ INFO
Definition
IMessageSvc.h:22
MSG::VERBOSE
@ VERBOSE
Definition
IMessageSvc.h:22
std
STL namespace.
GaudiTestSuite
src
ColorMsg
ColorMsgAlg.cpp
Generated on
for The Gaudi Framework by
1.17.0