forked from Silverfish/proton-bridge
GODT-2016: added more logging of gRPC events at info level.
This commit is contained in:
@ -43,7 +43,9 @@ void QMLBackend::init(GRPCConfig const &serviceConfig)
|
|||||||
{
|
{
|
||||||
users_ = new UserList(this);
|
users_ = new UserList(this);
|
||||||
|
|
||||||
app().grpc().setLog(&app().log());
|
Log& log = app().log();
|
||||||
|
log.info(QString("Connecting to gRPC service"));
|
||||||
|
app().grpc().setLog(&log);
|
||||||
this->connectGrpcEvents();
|
this->connectGrpcEvents();
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
|
|||||||
@ -80,6 +80,7 @@ Log &initLog()
|
|||||||
{
|
{
|
||||||
Log &log = app().log();
|
Log &log = app().log();
|
||||||
log.registerAsQtMessageHandler();
|
log.registerAsQtMessageHandler();
|
||||||
|
log.setEchoInConsole(true);
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +259,6 @@ int main(int argc, char *argv[])
|
|||||||
// In attached mode, we do not intercept stderr and stdout of bridge, as we did not launch it ourselves, so we output the log to the console.
|
// In attached mode, we do not intercept stderr and stdout of bridge, as we did not launch it ourselves, so we output the log to the console.
|
||||||
// When not in attached mode, log entries are forwarded to bridge, which output it on stdout/stderr. bridge-gui's process monitor intercept
|
// When not in attached mode, log entries are forwarded to bridge, which output it on stdout/stderr. bridge-gui's process monitor intercept
|
||||||
// these outputs and output them on the command-line.
|
// these outputs and output them on the command-line.
|
||||||
log.setEchoInConsole(attach);
|
|
||||||
log.setLevel(logLevel);
|
log.setLevel(logLevel);
|
||||||
|
|
||||||
if (!attach)
|
if (!attach)
|
||||||
@ -268,12 +268,16 @@ int main(int argc, char *argv[])
|
|||||||
launchBridge(args);
|
launchBridge(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info(QString("Retrieving gRPC service configuration from '%1'").arg(QDir::toNativeSeparators(grpcServerConfigPath())));
|
||||||
log.debug(QString("Server configuration file will be loaded from '%1'").arg(QDir::toNativeSeparators(grpcServerConfigPath())));
|
|
||||||
app().backend().init(GRPCClient::waitAndRetrieveServiceConfig(attach ? 0 : grpcServiceConfigWaitDelayMs));
|
app().backend().init(GRPCClient::waitAndRetrieveServiceConfig(attach ? 0 : grpcServiceConfigWaitDelayMs));
|
||||||
if (!attach)
|
if (!attach)
|
||||||
GRPCClient::removeServiceConfigFile();
|
GRPCClient::removeServiceConfigFile();
|
||||||
log.debug("Backend was successfully initialized.");
|
|
||||||
|
// gRPC communication is established. From now on, log events will be sent to bridge via gRPC. bridge will write these to file,
|
||||||
|
// and will output then on console if appropriate. If we are not running in attached mode we intercept bridge stdout & stderr and
|
||||||
|
// display it in our own output and error, so we only continue to log directly to console if we are running in attached mode.
|
||||||
|
log.setEchoInConsole(attach);
|
||||||
|
log.info("Backend was successfully initialized.");
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
std::unique_ptr<QQmlComponent> rootComponent(createRootQmlComponent(engine));
|
std::unique_ptr<QQmlComponent> rootComponent(createRootQmlComponent(engine));
|
||||||
|
|||||||
@ -125,6 +125,7 @@ func NewService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) startGRPCServer() {
|
func (s *Service) startGRPCServer() {
|
||||||
|
s.log.Info("Starting gRPC server")
|
||||||
tlsConfig, pemCert, err := s.generateTLSConfig()
|
tlsConfig, pemCert, err := s.generateTLSConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.WithError(err).Panic("Could not generate gRPC TLS config")
|
s.log.WithError(err).Panic("Could not generate gRPC TLS config")
|
||||||
@ -148,7 +149,7 @@ func (s *Service) startGRPCServer() {
|
|||||||
if path, err := s.saveGRPCServerConfigFile(); err != nil {
|
if path, err := s.saveGRPCServerConfigFile(); err != nil {
|
||||||
s.log.WithError(err).WithField("path", path).Panic("Could not write gRPC service config file")
|
s.log.WithError(err).WithField("path", path).Panic("Could not write gRPC service config file")
|
||||||
} else {
|
} else {
|
||||||
s.log.WithField("path", path).Debug("Successfully saved gRPC service config file")
|
s.log.WithField("path", path).Info("Successfully saved gRPC service config file")
|
||||||
}
|
}
|
||||||
|
|
||||||
s.log.Info("gRPC server listening at ", s.listener.Addr())
|
s.log.Info("gRPC server listening at ", s.listener.Addr())
|
||||||
|
|||||||
Reference in New Issue
Block a user