func (cs *Client) Log(typ params.LogType, level params.LogLevel, message string, urls ...*charm.URL) error {
	b, err := json.Marshal(message)
	if err != nil {
		return errgo.Notef(err, "cannot marshal log message")
	}

	// Prepare and send the log.
	// TODO (frankban): we might want to buffer logs in order to reduce
	// requests.
	logs := []params.Log{{
		Data:  (*json.RawMessage)(&b),
		Level: level,
		Type:  typ,
		URLs:  urls,
	}}
	b, err = json.Marshal(logs)
	if err != nil {
		return errgo.Notef(err, "cannot marshal log message")
	}

	req, err := http.NewRequest("POST", "", bytes.NewReader(b))
	if err != nil {
		return errgo.Notef(err, "cannot create log request")
	}
	req.Header.Set("Content-Type", "application/json")
	resp, err := cs.Do(req, "/log")
	if err != nil {
		return errgo.NoteMask(err, "cannot send log message", isAPIError)
	}
	resp.Body.Close()
	return nil
}
// Log sends a log message to the charmstore's log database.
Log sends a log message to the charmstore's log database.
// Log sends a log message to the charmstore ' s log database .
func (cs *Client) Log(typ params.LogType, level params.LogLevel, message string, urls ...*charm.URL) error {
	b, err := json.Marshal(message)
	if err != nil {
		return errgo.Notef(err, "cannot marshal log message")
	}
	logs := []params.Log{{
		Data:  (*json.RawMessage)(&b),
		Level: level,
		Type:  typ,
		URLs:  urls,
	}}
	b, err = json.Marshal(logs)
	if err != nil {
		return errgo.Notef(err, "cannot marshal log message")
	}
	req, err := http.NewRequest("POST", "", bytes.NewReader(b))
	if err != nil {
		return errgo.Notef(err, "cannot create log request")
	}
	req.Header.Set("Content-Type", "application/json")
	resp, err := cs.Do(req, "/log")
	if err != nil {
		return errgo.NoteMask(err, "cannot send log message", isAPIError)
	}
	resp.Body.Close()
	return nil
}
func ( cs * Client ) Log ( typ params . LogType , level params . LogLevel , message string , urls ... * charm . URL ) error { b , err := json . Marshal ( message ) if err != nil { return errgo . Notef ( err , " " ) } logs := [ ] params . Log { { Data : ( * json . RawMessage ) ( & b ) , Level : level , Type : typ , URLs : urls , } } b , err = json . Marshal ( logs ) if err != nil { return errgo . Notef ( err , " " ) } req , err := http . NewRequest ( " " , " " , bytes . NewReader ( b ) ) if err != nil { return errgo . Notef ( err , " " ) } req . Header . Set ( " " , " " ) resp , err := cs . Do ( req , " " ) if err != nil { return errgo . NoteMask ( err , " " , isAPIError ) } resp . Body . Close ( ) return nil }
Log sends a log message to the charmstore's log database.
Log sends a log message to the charmstore ' s log database .
// Prepare and send the log. // TODO (frankban): we might want to buffer logs in order to reduce // requests.