Exemplo n.º 1
0
func status() (err error) {

	adminClient, err := common.GetAdminClient()
	if err != nil {
		logger.Warningf("%s", err)
		fmt.Println(&pb.ServerStatus{Status: pb.ServerStatus_UNKNOWN})
		return err
	}

	status, err := adminClient.GetStatus(context.Background(), &empty.Empty{})
	if err != nil {
		logger.Infof("Error trying to get status from local peer: %s", err)
		err = fmt.Errorf("Error trying to connect to local peer: %s", err)
		fmt.Println(&pb.ServerStatus{Status: pb.ServerStatus_UNKNOWN})
		return err
	}
	fmt.Println(status)
	return nil
}
Exemplo n.º 2
0
func getLevel(cmd *cobra.Command, args []string) (err error) {
	err = checkLoggingCmdParams(cmd, args)

	if err != nil {
		logger.Warningf("Error: %s", err)
	} else {
		adminClient, err := common.GetAdminClient()
		if err != nil {
			logger.Warningf("%s", err)
			return err
		}

		logResponse, err := adminClient.GetModuleLogLevel(context.Background(), &pb.LogLevelRequest{LogModule: args[0]})

		if err != nil {
			logger.Warningf("Error retrieving log level")
			return err
		}
		logger.Infof("Current log level for peer module '%s': %s", logResponse.LogModule, logResponse.LogLevel)
	}
	return err
}