// Publish publishers for writing to stdout.
Publish publishers for writing to stdout.
// Publish publishers for writing to stdout .
func (s *Stdout) Publish(data map[string]interface{}) {
	rawJSON, err := json.Marshal(data)
	if err != nil {
		s.log.Println("Stdout : Marshal ERROR :", err)
		return
	}
	var d map[string]interface{}
	if err := json.Unmarshal(rawJSON, &d); err != nil {
		s.log.Println("Stdout : Unmarshal ERROR :", err)
		return
	}
	memStats, ok := (d["memstats"]).(map[string]interface{})
	if ok {
		d["heap"] = memStats["Alloc"]
	}
	delete(d, "memstats")
	delete(d, "cmdline")
	out, err := json.MarshalIndent(d, "", "    ")
	if err != nil {
		return
	}
	s.log.Println("Stdout :\n", string(out))
}
func ( s * Stdout ) Publish ( data map [ string ] interface { } ) { rawJSON , err := json . Marshal ( data ) if err != nil { s . log . Println ( " " , err ) return } var d map [ string ] interface { } if err := json . Unmarshal ( rawJSON , & d ) ; err != nil { s . log . Println ( " " , err ) return } memStats , ok := ( d [ " " ] ) . ( map [ string ] interface { } ) if ok { d [ " " ] = memStats [ " " ] } delete ( d , " " ) delete ( d , " " ) out , err := json . MarshalIndent ( d , " " , " " ) if err != nil { return } s . log . Println ( " \n " , string ( out ) ) }
Publish publishers for writing to stdout.
Publish publishers for writing to stdout .
// Add heap value into the data set. // Remove uncessary keys.