   defp init(config, state) do
     level = Keyword.get(config, :level)
     device = Keyword.get(config, :device, :user)
-    format = Logger.Formatter.compile Keyword.get(config, :format)
+    format = Logger.Formatter.compile(Keyword.get(config, :format))
     colors = configure_colors(config)
     metadata = Keyword.get(config, :metadata, []) |> configure_metadata()
     max_buffer = Keyword.get(config, :max_buffer, 32)
 
-    %{state | format: format, metadata: metadata,
-              level: level, colors: colors, device: device, max_buffer: max_buffer}
+    %{
+      state
+      | format: format,
+        metadata: metadata,
+        level: level,
+        colors: colors,
+        device: device,
+        max_buffer: max_buffer
+    }
   end
 
   defp configure_metadata(:all), do: :all

  end

  def handle_event({level, _gl, {Logger, msg, ts, md}}, state) do
    %{level: log_level, ref: ref, buffer_size: buffer_size,
      max_buffer: max_buffer} = state
    cond do
      not meet_level?(level, log_level) ->
        {:ok, state}
      is_nil(ref) ->
        {:ok, log_event(level, msg, ts, md, state)}
      buffer_size < max_buffer ->
        {:ok, buffer_event(level, msg, ts, md, state)}
      buffer_size === max_buffer ->
        state = buffer_event(level, msg, ts, md, state)
        {:ok, await_io(state)}


  defp configure_colors(config) do
    colors = Keyword.get(config, :colors, [])

    %{
      debug: Keyword.get(colors, :debug, :cyan),
      info: Keyword.get(colors, :info, :normal),
      warn: Keyword.get(colors, :warn, :yellow),
      error: Keyword.get(colors, :error, :red),
      enabled: Keyword.get(colors, :enabled, IO.ANSI.enabled?())
    }
  end

  defp log_event(level, msg, ts, md, %{device: device} = state) do
