The Gaudi Framework  v41r0 (bdbe7744)
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"
14
15// Static Factory declaration
16
18
19
20
21ColorMsgAlg::ColorMsgAlg( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ) {}
22
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
26
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
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
77}
78
79/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
80
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
StatusCode finalize() override
StatusCode execute() override
ColorMsgAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize() override
MsgStream & msgStream() const
Return an uninitialized MsgStream.
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition Algorithm.h:98
const std::string & name() const override
The identifying name of the algorithm object.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
@ GREEN
Definition IMessageSvc.h:23
@ WHITE
Definition IMessageSvc.h:23
@ YELLOW
Definition IMessageSvc.h:23
@ PURPLE
Definition IMessageSvc.h:23
@ BLUE
Definition IMessageSvc.h:23
@ RED
Definition IMessageSvc.h:23
@ WARNING
Definition IMessageSvc.h:22
@ FATAL
Definition IMessageSvc.h:22
@ DEBUG
Definition IMessageSvc.h:22
@ ERROR
Definition IMessageSvc.h:22
@ INFO
Definition IMessageSvc.h:22
@ VERBOSE
Definition IMessageSvc.h:22
STL namespace.