import ( "github.com/dotcloud/docker/utils" "fmt" ) func main() { inspectData := `{"ID":"4c4ea0ad8b4c93df63d462c1bd0d42eac9c2fa6e994d6a2b6dd7b509847f43d1", "Name": "/mycontainer", "Created": "2021-07-14T02:33:14.183941004Z", "State": {"Status": "running", "Pid": 12654}}` formattedOutput := utils.StreamFormatter(inspectData) fmt.Println(formattedOutput) }
ID: 4c4ea0ad8b4c Name: /mycontainer Created: 2021-07-14T02:33:14.183941004Z State: Status: running Pid: 12654
import ( "github.com/dotcloud/docker/utils" "log" ) func dockerLogsToHumanReadable(logs []byte) { formattedLogs := utils.StreamFormatter(string(logs)) log.Println(formattedLogs) }This function will take in Docker logs as a byte array and output the formatted logs in a more readable format using the StreamFormatter utility.