satellite: revert log lines used to figure out node id

Currently storj-sim relies on the log lines to be exactly the same,
when they change it cannot find the necessary information from log.

Change-Id: Ia039915ef3375a7cf60f107b2c05c958de15b6d5
This commit is contained in:
Egon Elbre 2020-04-15 16:57:14 +03:00
parent 90bac51544
commit d3ce845f82
3 changed files with 11 additions and 8 deletions

View File

@ -80,8 +80,8 @@ func (writer *prefixWriter) Write(data []byte) (int, error) {
var newID string
if writer.id == "" {
if start := bytes.Index(data, []byte(`Node started. {"Node ID": "`)); start > 0 {
if end := bytes.Index(data[start:], []byte(`"`)); end > 0 {
if start := bytes.Index(data, []byte("Node ")); start > 0 {
if end := bytes.Index(data[start:], []byte(" started")); end > 0 {
newID = string(data[start+5 : start+end])
if len(newID) > maxIDLength {
newID = newID[:maxIDLength]

View File

@ -6,6 +6,7 @@ package satellite
import (
"context"
"errors"
"fmt"
"net"
"net/mail"
"net/smtp"
@ -247,9 +248,9 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB,
Name: "server",
Run: func(ctx context.Context) error {
// Don't change the format of this comment, it is used to figure out the node id.
peer.Log.Info("Node started.", zap.Stringer("Node ID", peer.Identity.ID))
peer.Log.Info("Public server started.", zap.String("Address", peer.Addr()))
peer.Log.Info("Private server started.", zap.String("Address", peer.PrivateAddr()))
peer.Log.Info(fmt.Sprintf("Node %s started", peer.Identity.ID))
peer.Log.Info(fmt.Sprintf("Public server started on %s", peer.Addr()))
peer.Log.Info(fmt.Sprintf("Private server started on %s", peer.PrivateAddr()))
return peer.Server.Run(ctx)
},
Close: peer.Server.Close,

View File

@ -6,6 +6,7 @@ package storagenode
import (
"context"
"errors"
"fmt"
"net"
"net/http"
"time"
@ -313,9 +314,10 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
peer.Servers.Add(lifecycle.Item{
Name: "server",
Run: func(ctx context.Context) error {
peer.Log.Info("Node started.", zap.Stringer("Node ID", peer.Identity.ID))
peer.Log.Info("Public server started.", zap.String("Address", peer.Addr()))
peer.Log.Info("Private server started.", zap.String("Address", peer.PrivateAddr()))
// Don't change the format of this comment, it is used to figure out the node id.
peer.Log.Info(fmt.Sprintf("Node %s started", peer.Identity.ID))
peer.Log.Info(fmt.Sprintf("Public server started on %s", peer.Addr()))
peer.Log.Info(fmt.Sprintf("Private server started on %s", peer.PrivateAddr()))
return peer.Server.Run(ctx)
},
Close: peer.Server.Close,