GODT-2016: added more logging of gRPC events at info level.

This commit is contained in:
Xavier Michelon
2022-11-02 15:19:04 +01:00
parent 8ca849b7a8
commit cb871ce4bc
3 changed files with 13 additions and 6 deletions

View File

@ -43,7 +43,9 @@ void QMLBackend::init(GRPCConfig const &serviceConfig)
{
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();
QString error;

View File

@ -80,6 +80,7 @@ Log &initLog()
{
Log &log = app().log();
log.registerAsQtMessageHandler();
log.setEchoInConsole(true);
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.
// 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.
log.setEchoInConsole(attach);
log.setLevel(logLevel);
if (!attach)
@ -268,12 +268,16 @@ int main(int argc, char *argv[])
launchBridge(args);
}
log.debug(QString("Server configuration file will be loaded from '%1'").arg(QDir::toNativeSeparators(grpcServerConfigPath())));
log.info(QString("Retrieving gRPC service configuration from '%1'").arg(QDir::toNativeSeparators(grpcServerConfigPath())));
app().backend().init(GRPCClient::waitAndRetrieveServiceConfig(attach ? 0 : grpcServiceConfigWaitDelayMs));
if (!attach)
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;
std::unique_ptr<QQmlComponent> rootComponent(createRootQmlComponent(engine));

View File

@ -125,6 +125,7 @@ func NewService(
}
func (s *Service) startGRPCServer() {
s.log.Info("Starting gRPC server")
tlsConfig, pemCert, err := s.generateTLSConfig()
if err != nil {
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 {
s.log.WithError(err).WithField("path", path).Panic("Could not write gRPC service config file")
} 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())