// Logs retrieves logs from an app.
770388
func Logs(c *client.Client, appID string, lines int) (string, error) {
	u := fmt.Sprintf("/v1/apps/%s/logs", appID)

	if lines > 0 {
		u += "?log_lines=" + strconv.Itoa(lines)
	}

	body, err := c.BasicRequest("GET", u, nil)

	if err != nil {
		return "", err
	}

	return strings.Trim(body, `"`), nil
}
645924
func (s *Server) ReadLogs(app string, lines int) ([]string, error) {
	// Get a read lock to ensure the storage adapater pointer can't be updated by another
	// goroutine in the time between we check if it's nil and the time we invoke .Read() upon
	// it.
	s.adapterMutex.RLock()
	defer s.adapterMutex.RUnlock()
	if s.storageAdapter == nil {
		return nil, fmt.Errorf("Could not find logs for '%s'.  No storage adapter specified.", app)
	}
	return s.storageAdapter.Read(app, lines)
}
1336765
func (api *SIMAPI) Logs(id int64, body interface{}) ([]sacloud.SIMLog, error) {
	var (
		method = "GET"
		uri    = fmt.Sprintf("%s/%d/sim/sessionlog", api.getResourceURL(), id)
	)

	res := &simLogResponse{}
	err := api.baseAPI.request(method, uri, body, res)
	if err != nil {
		return nil, err
	}
	return res.Logs, nil
}
494493
func (l *RequestLogger) log(r *request.Request) {
	service := r.ClientInfo.ServiceName
	name := "?"
	if r.Operation != nil {
		name = r.Operation.Name
	}
	methodDescription := service + "/" + name

	glog.V(l.logLevel).Infof("AWS request: %s", methodDescription)
}
1156935
func (rl *respLogger) Log() {
	latency := time.Since(rl.startTime)
	if klog.V(3) {
		if !rl.hijacked {
			klog.InfoDepth(1, fmt.Sprintf("%s %s: (%v) %v%v%v [%s %s]", rl.req.Method, rl.req.RequestURI, latency, rl.status, rl.statusStack, rl.addedInfo, rl.req.UserAgent(), rl.req.RemoteAddr))
		} else {
			klog.InfoDepth(1, fmt.Sprintf("%s %s: (%v) hijacked [%s %s]", rl.req.Method, rl.req.RequestURI, latency, rl.req.UserAgent(), rl.req.RemoteAddr))
		}
	}
}
892902
func Logs() fibre.MiddlewareFunc {
	return func(h fibre.HandlerFunc) fibre.HandlerFunc {
		return func(c *fibre.Context) (err error) {

			err = h(c)

			ip := c.IP()
			req := c.Request()
			res := c.Response()
			num := res.Status()
			now := c.Request().Start()
			met := req.Method
			url := req.URL().Path
			log := c.Fibre().Logger().WithField("prefix", c.Fibre().Name())

			if c.Socket() != nil {
				met = "WS"
			}

			if err, ok := err.(*fibre.HTTPError); ok {
				num = err.Code()
				log = log.WithFields(err.Fields())
			}

			log = log.WithFields(map[string]interface{}{
				"ctx":     c,
				"ip":      ip,
				"url":     url,
				"size":    res.Size(),
				"status":  num,
				"method":  met,
				"latency": time.Since(now),
			})

			if id := c.Get("id"); id != nil {
				log = log.WithField("id", id)
			}

			if err != nil {
				log = log.WithError(err)
			}

			switch {
			case num >= 500:
				log.Error("Completed request")
			case num >= 400:
				log.Warn("Completed request")
			case num >= 300:
				log.Info("Completed request")
			case num >= 200:
				log.Info("Completed request")
			default:
				log.Info("Completed request")
			}

			return err

		}
	}
}
1019553
func (l *SwapLogger) Log(keyvals ...interface{}) error {
	s, ok := l.logger.Load().(loggerStruct)
	if !ok || s.Logger == nil {
		return nil
	}
	return s.Log(keyvals...)
}
654957
func (log Logger) Log(lvl level, source, message string) {
	log.intLogNamef(logName(lvl), lvl, message)
}
805345
func (c *Context) Log(data Data) error {
	return c.Logger.Log(c.Merge(data))
}
672414
func (e *Empire) StreamLogs(app *App, w io.Writer, duration time.Duration) error {
	if err := e.LogsStreamer.StreamLogs(app, w, duration); err != nil {
		return fmt.Errorf("error streaming logs: %v", err)
	}

	return nil
}
155832
func (self *Service) Logs(c chan Logs) {

	endpoint := "service/" + self.Uuid + "/logs/?user=" + User + "&token=" + ApiKey
	url := StreamUrl + endpoint

	header := http.Header{}
	header.Add("User-Agent", customUserAgent)

	var Dialer websocket.Dialer
	ws, _, err := Dialer.Dial(url, header)
	if err != nil {
		log.Println(err)
	}

	var msg Logs
	for {
		if err = ws.ReadJSON(&msg); err != nil {
			if err != nil && err.Error() != "EOF" {
				log.Println(err)
			} else {
				break
			}
		}
		c <- msg
	}
}
234261
func (logger *Logger) Log(level Level, v ...interface{}) {
	// Don't delete this calling. The calling is used to keep the same
	// calldepth for all the logging functions. The calldepth is used to
	// get runtime information such as line number, function name, etc.
	logger.log(level, v...)
}
1175661
func (inv *Investigate) Log(s string) {
	if inv.verbose {
		inv.log.Println(s)
	}
}
953829
func (c *CustomHandler) Log(e log.Entry) {

	// below prints to os.Stderr but could marshal to JSON
	// and send to central logging server
	//																						       ---------
	// 				                                                                 |----------> | console |
	//                                                                               |             ---------
	// i.e. -----------------               -----------------     Unmarshal    -------------       --------
	//     | app log handler | -- json --> | central log app | --    to    -> | log handler | --> | syslog |
	//      -----------------               -----------------       Entry      -------------       --------
	//      																         |             ---------
	//                                  									         |----------> | DataDog |
	//          																	        	   ---------
	b := new(bytes.Buffer)
	b.Reset()
	b.WriteString(e.Message)

	for _, f := range e.Fields {
		fmt.Fprintf(b, " %s=%v", f.Key, f.Value)
	}
	fmt.Println(b.String())
}
219244
func (l *logStream) Log(msg *logger.Message) error {
	l.lock.RLock()
	defer l.lock.RUnlock()
	if l.closed {
		return errors.New("awslogs is closed")
	}
	if l.logNonBlocking {
		select {
		case l.messages <- msg:
			return nil
		default:
			return errors.New("awslogs buffer is full")
		}
	}
	l.messages <- msg
	return nil
}
900903
func (l *DefaultLogger) Log(level int, msg string, args []interface{}) {
	// log if the log level (warn=4) >= level of message (err=3)
	if l.level < level || silent {
		return
	}
	l.formatter.Format(l.writer, level, msg, args)
}
1218590
func (cl *Call) Log(arguments ...interface{}) {
	cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
}