Skip to content

Commit

Permalink
disabling verbose logging by default and made configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
holsee committed May 8, 2018
1 parent c01cac4 commit 9b80875
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end
config :logger,
:console,
metadata: [:request_id, :pid, :module],
level: :info
level: :debug

config :chroxy,
chrome_remote_debug_port_from: envar.("CHROXY_CHROME_PORT_FROM") || "9222",
Expand All @@ -46,4 +46,5 @@ config :chroxy, Chroxy.Endpoint,

config :chroxy, Chroxy.ChromeServer,
page_wait_ms: envar.("CHROXY_CHROME_SERVER_PAGE_WAIT_MS") || "200",
crash_dumps_dir: envar.("CHROME_CHROME_SERVER_CRASH_DUMPS_DIR") || "/tmp"
crash_dumps_dir: envar.("CHROME_CHROME_SERVER_CRASH_DUMPS_DIR") || "/tmp",
verbose_logging: 0
9 changes: 8 additions & 1 deletion lib/chroxy/chrome_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ defmodule Chroxy.ChromeServer do
{:noreply, state}
end

def handle_info({device, pid, <<_::size(@log_head_size), ":VERBOSE1:", msg::binary>>}, state)
when device == :stdout or device == :stderr do
msg = String.replace(msg, "\r\n", "")
Logger.debug("[CHROME: #{inspect(pid)}] #{inspect(msg)}")
{:noreply, state}
end

# TODO refactor messages from logs to remove "\r\n" once / create module to
# handle log parsing
def handle_info(
Expand Down Expand Up @@ -332,7 +339,7 @@ defmodule Chroxy.ChromeServer do
--no-sandbox
--incognito
),
verbose_logging: 1,
verbose_logging: 0,
crash_dumps_dir: "/tmp"
]
end
Expand Down

0 comments on commit 9b80875

Please sign in to comment.