Logo ROOT  
Reference Guide
rootwebpage.cpp
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2017-06-29
3// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
4
5/*************************************************************************
6 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#include "rootwebpage.h"
14
15#include <ROOT/RLogger.hxx>
16#include "TString.h"
17#include "TEnv.h"
18#include <iostream>
19
21{
22 static ROOT::Experimental::RLogChannel sChannel("ROOT.QtWebDisplay");
23 return sChannel;
24}
25
26/** \class RootWebPage
27\ingroup qt5webdisplay
28*/
29
30
32{
33 fConsole = gEnv->GetValue("WebGui.Console", (int)0);
34}
35
36void RootWebPage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel lvl, const QString &message, int lineNumber,
37 const QString &src)
38{
39 TString msg = TString::Format("%s:%d: %s", src.toLatin1().constData(), lineNumber,
40 message.toLatin1().constData());
41
42 switch (lvl) {
43 case InfoMessageLevel:
44 R__LOG_DEBUG(0, QtWebDisplayLog()) << msg;
45 if (fConsole > 0)
46 std::cout << msg << std::endl;
47 break;
48 case WarningMessageLevel:
50 if (fConsole > 0)
51 std::cout << msg << std::endl;
52 break;
53 case ErrorMessageLevel:
55 if (fConsole > 0)
56 std::cerr << msg << std::endl;
57 break;
58 }
59}
#define R__LOG_WARNING(...)
Definition: RLogger.hxx:363
#define R__LOG_ERROR(...)
Definition: RLogger.hxx:362
#define R__LOG_DEBUG(DEBUGLEVEL,...)
Definition: RLogger.hxx:365
R__EXTERN TEnv * gEnv
Definition: TEnv.h:170
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
A log configuration for a channel, e.g.
Definition: RLogger.hxx:101
RootWebPage(QObject *parent=nullptr)
Definition: rootwebpage.cpp:31
virtual void javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
Definition: rootwebpage.cpp:36
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
Basic string class.
Definition: TString.h:136
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2341
ROOT::Experimental::RLogChannel & QtWebDisplayLog()
Definition: rootwebpage.cpp:20