Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change log level from "info" to "debug" #488

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ There are also some selectors based on non-standard specifications. They are:
| E:fl-contains('foo') | an E element that contains "foo" inside a text node |
| E:fl-icontains('foo') | an E element that contains "foo" inside a text node (case insensitive) |

## Suppressing log messages

Floki may log debug messages related to problems in the parsing of selectors, or parsing of the HTML tree.
It also may log some "info" messages related to deprecated APIs. If you want to suppress these log messages,
please consider setting the `:compile_time_purge_matching` option for `:logger` in your compile time configuration.

See https://hexdocs.pm/logger/Logger.html#module-compile-configuration for details.

## Special thanks

* [@arasatasaygin](https://github.com/arasatasaygin) for Floki's logo from the [Open Logos project](http://openlogos.org/).
Expand Down
2 changes: 0 additions & 2 deletions lib/floki/finder.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
defmodule Floki.Finder do
require Logger

@moduledoc false

# The finder engine traverse the HTML tree searching for nodes matching
Expand Down
2 changes: 1 addition & 1 deletion lib/floki/selector.ex
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ defmodule Floki.Selector do
end

defp pseudo_class_match?(_html_node, %{name: unknown_pseudo_class}, _tree) do
Logger.info(fn ->
Logger.debug(fn ->
"Pseudo-class #{inspect(unknown_pseudo_class)} is not implemented. Ignoring."
end)

Expand Down
6 changes: 3 additions & 3 deletions lib/floki/selector/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ defmodule Floki.Selector.Parser do
end

defp do_parse([{:unknown, _, unknown} | t], selector) do
Logger.info(fn -> "Unknown token #{inspect(unknown)}. Ignoring." end)
Logger.debug(fn -> "Unknown token #{inspect(unknown)}. Ignoring." end)

do_parse(t, selector)
end
Expand Down Expand Up @@ -179,7 +179,7 @@ defmodule Floki.Selector.Parser do
end

defp consume_attribute(:consuming, [unknown | t], attr_selector) do
Logger.info(fn -> "Unknown token #{inspect(unknown)}. Ignoring." end)
Logger.debug(fn -> "Unknown token #{inspect(unknown)}. Ignoring." end)
consume_attribute(:consuming, t, attr_selector)
end

Expand Down Expand Up @@ -264,7 +264,7 @@ defmodule Floki.Selector.Parser do
end

defp update_pseudo_not_value(_pseudo_class, _pseudo_not_selector) do
Logger.info("Only simple selectors are allowed in :not() pseudo-class. Ignoring.")
Logger.debug("Only simple selectors are allowed in :not() pseudo-class. Ignoring.")
nil
end
end
2 changes: 1 addition & 1 deletion lib/floki/selector/pseudo_class.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ defmodule Floki.Selector.PseudoClass do
relative_position in s

expression ->
Logger.info(fn ->
Logger.debug(fn ->
"Pseudo-class #{name} with expressions like #{inspect(expression)} are not supported yet. Ignoring."
end)

Expand Down