You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
Could be helpful to have a way to display HTTP requests info.
In the CLI program we could add a command line parameter to the server command, say --tail which would display the HTTP requests being handled by the server.
In the core package, we currently do not have a log middleware. We'd need one and use the logger to ourput nice output, but only if we used the --tail option.
This means that in the config we would need to add a new option to indicate if we want to display the server log or not.
The log middleware would be added to all middleware chains only if that config flag is true.
What I mean by middleware chains can be found in server.go:117:
Thanks @mauriceLC92 highly appreciated. Here's a couple of tips since you will need to modify this project core and the cli
The cli import the core project, to make this work you'll need to replace the package in the cli to say you want to use your local version:
Clone both projects side-by-side, ex: ~/src/staticbackend/ have the core and cli there.
In the cli go.mod add replace github.com/staticbackendhq/core => ../core
From there you should be able to make changes in the core to create the log middleware and the changes to config and build the cli. Not optimal, still trying to figure out the best workflow for this.
I'm using make build to build the cli and from there you will have a binary called backend
Could be helpful to have a way to display HTTP requests info.
In the CLI program we could add a command line parameter to the
server
command, say--tail
which would display the HTTP requests being handled by the server.In the
core
package, we currently do not have alog
middleware. We'd need one and use thelogger
to ourput nice output, but only if we used the--tail
option.This means that in the
config
we would need to add a new option to indicate if we want to display the server log or not.The log middleware would be added to all middleware chains only if that config flag is true.
What I mean by middleware chains can be found in
server.go:117
:Since they are this function receive the config, the log middleware could accept a flag to be verbose or not, ex:
Assuming the
config
flag would be calledTailRequests
and the log middlewareLog
.If
TailRequests
is false the middleware simply do nothing.The text was updated successfully, but these errors were encountered: