           minor_version: log.version.minor,
           patch_version: log.version.patch,
         }
-        log_without_pos = %{created_at: log.time, meta: meta, channels: log.meta[:channels] || [], message: log.message}
+        log_without_pos = %{
+          created_at: log.time,
+          meta: meta,
+          channels: log.meta[:channels] || [],
+          message: log.message
+        }
         log = add_position_to_log(log_without_pos, location_data)
         push_bot_log(state.chan, state.bot, log)
       end

  end

  defp emit_cs(chan, bot, cs) do
    with {:ok, map} <- Farmbot.CeleryScript.AST.encode(cs),
         {:ok, json} <- Poison.encode(map)
    do
      :ok = AMQP.Basic.publish chan, @exchange, "bot.#{bot}.from_device", json

  def handle_log_events(logs, state) do
    for %Farmbot.Log{} = log <- logs do
      if should_log?(log.module, log.verbosity) do
        fb = %{position: %{x: -1, y: -1, z: -1}}
        location_data = Map.get(state.state_cache || %{}, :location_data, fb)
        meta = %{
          type: log.level,
          x: nil, y: nil, z: nil,
