stevensonmt

stevensonmt

Well this is embarrassing. Logger vs IO.inspect

I was today years old when I learned to use Logger.notice instead of IO.inspect everywhere that I wanted to peek at what was going on with the state of my application. Maybe dialyzer or mix could suggest that instead of just warning “There should be no calls to inspect.”

Most Liked

fireproofsocks

fireproofsocks

I don’t think the two are equivalent… both are fruit, but apples and oranges?

notice indicates the severity of the message logged – if you have a logging threshold of info, for example, debug messages won’t show up but notices will. The syslog protocol defines the available severities with numerical codes (see section 6.2.1 table 2 on page 11). A “notice” is described as “normal but significant condition” and it lives right between “info” and “warning”.

I’m not an expert on this, but Logger sends messages buffered to specific targets whereas IO.inspect is pegged to STDOUT. Sometimes I have to remember this e.g. if I start a process in one iex session and when I join it via another Terminal window. IO.inspect may be visible in one and not the other.

hauleth

hauleth

Credo has such warning.

LostKobrakai

LostKobrakai

Very much this. IO.inspect is the printf of elixir, while Logger is a means of logging to configurable backends with multiple capabilities besides raw string logs, …. The stuff you’d pull in a library for in many languages.

Where Next?

Popular in Discussions Top

pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
Qqwy
Looking at the stacks that existing large companies have used, WhatsApp internally uses Mnesia to store the messages, while Discord uses ...
New
ejpcmac
I have discovered Nix last month and I am currently on my way to migrating to it—both on macOS at home and the full NixOS distrubution at...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
Qqwy
I would like to spark a discussion about the static access operator: .. For whom does not know: it is used in Elixir to access fields of...
New
rms.mrcs
A couple of days ago I was discussing with a friend about different approaches to write microservices. He said that if he was going to w...
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement