MCPcopy Create free account
hub / github.com/OpenPrinting/goipp / fmtMessage

Method fmtMessage

formatter.go:107–127  ·  view source on GitHub ↗

fmtMessage formats a request or response Message.

(msg *Message, request bool)

Source from the content-addressed store, hash-verified

105
106// fmtMessage formats a request or response Message.
107func (f *Formatter) fmtMessage(msg *Message, request bool) {
108 f.Printf("{")
109 f.indent++
110
111 f.Printf("REQUEST-ID %d", msg.RequestID)
112 f.Printf("VERSION %s", msg.Version)
113
114 if request {
115 f.Printf("OPERATION %s", Op(msg.Code))
116 } else {
117 f.Printf("STATUS %s", Status(msg.Code))
118 }
119
120 if groups := msg.AttrGroups(); len(groups) != 0 {
121 f.Printf("")
122 f.FmtGroups(groups)
123 }
124
125 f.indent--
126 f.Printf("}")
127}
128
129// FmtGroups formats a [Groups] slice.
130func (f *Formatter) FmtGroups(groups Groups) {

Callers 2

FmtRequestMethod · 0.95
FmtResponseMethod · 0.95

Calls 5

PrintfMethod · 0.95
FmtGroupsMethod · 0.95
OpTypeAlias · 0.85
StatusTypeAlias · 0.85
AttrGroupsMethod · 0.80

Tested by

no test coverage detected