-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
anvil logs to a tmp file #42
Conversation
for _, l2OpSim := range s.l2OpSims { | ||
fmt.Fprintf(&b, " Chain ID: %d RPC: %s\n", l2OpSim.ChainId(), l2OpSim.Endpoint()) | ||
for id, l2OpSim := range s.l2OpSims { | ||
fmt.Fprintf(&b, " Chain ID: %d RPC: %s LogPath: %s\n", l2OpSim.ChainId(), l2OpSim.Endpoint(), s.l2Anvils[id].LogPath()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i doubt this will happen the way everything is setup but i'm wondering if we should add a nil
check for this specifically s.l2Anvils[id].LogPath()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm given the setup there's no good way to gracefully recover from a programming mistake here so better to simply panic
we can add a unit test though that asserts the key is present in both maps when setup. That should cover this case
@@ -90,7 +92,12 @@ func (a *Anvil) Start(ctx context.Context) error { | |||
anvilPortCh := make(chan uint64) | |||
|
|||
// Handle stdout/stderr | |||
// - TODO: Figure out best way to dump into logger. Some hex isn't showing appropriately | |||
logFile, err := os.CreateTemp("", fmt.Sprintf("anvil-chain-%d-", a.cfg.ChainId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra -
at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah this was a mistake, will remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah wait no actually the extra -
is there becase CreateTemp
appends a random string of characters at the end for name collision
for now we rely on inspecting the anvil logs to grab the port when bound to
0
.Rather than use the
--silent
flag, dump anvil log to temporary files such that they are inspectable for the user