Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Elixir
  3. ecto_dev_logger

ecto_dev_logger

Apache-2.0Elixirv0.15.0

An Ecto query logger that inlines bindings into SQL for easy copy-paste debugging and highlights database time.

GitHubGitHub
181 stars18 forks0 contributors

What is ecto_dev_logger?

Ecto.DevLogger is an alternative logger for Ecto queries that transforms logged SQL by directly inlining parameter bindings, converting Elixir values like UUIDs, DateTimes, and Decimals into SQL literals. It produces copy-pasteable SQL that can be run directly in database IDEs, improving the debugging experience for developers. The logger also highlights database execution time and source tables to quickly identify slow queries.

Target Audience

Elixir developers using Ecto for database interactions who need to debug SQL queries in development environments, particularly those who frequently copy queries into database management tools for analysis.

Value Proposition

Developers choose Ecto.DevLogger because it eliminates the manual conversion of Elixir data types to SQL, saving time and reducing errors during debugging. Its unique selling point is generating immediately executable SQL with inline bindings and highlighting for readability, unlike default Ecto logging which leaves parameters separate.

Overview

An alternative logger for Ecto queries

Use Cases

Best For

  • Debugging complex Ecto queries by copying and pasting SQL directly into database IDEs without manual parameter conversion.
  • Identifying slow database queries in development through highlighted execution times and table names.
  • Working with PostgreSQL-specific types (like INET, MACADDR, ranges, or PostGIS geometries) and needing them logged as valid SQL literals.
  • Development environments where you want to restrict logging to the :dev Mix environment for safety and performance.
  • Suppressing logs for specific Repo operations (e.g., migrations or sensitive queries) using telemetry_options while keeping the logger active for others.
  • Extending SQL logging with custom formatting (e.g., via pgFormatter) or implementing PrintableParameter for custom Elixir types.

Not Ideal For

  • Production environments or applications requiring server-side logging, as it's designed for development use only and installation can be restricted to the :dev Mix environment.
  • Projects where precise SQL type matching is critical, since it operates below Ecto's type casting and may not align with schema types (e.g., maps always logged as JSON even for hstore columns).
  • Teams using databases other than PostgreSQL extensively, as many rendering features and examples are PostgreSQL-specific and might not handle other databases' types out-of-the-box.

Pros & Cons

Pros

Inline Parameter Binding

Automatically converts Elixir values like UUIDs, DateTimes, and Decimals into SQL literals, producing copy-pasteable SQL for direct use in database IDEs without manual conversion, as demonstrated in the screenshot.

Development-Focused Safety

Can be installed only in the :dev Mix environment, preventing accidental production use and aligning with secure development practices, as detailed in the 'Development Only Installation' section.

Flexible Logging Control

Supports suppressing logs for specific Repo operations via telemetry_options: [log: false], allowing fine-grained control over what gets logged without disabling the logger entirely.

Extensible Type Handling

Uses the PrintableParameter protocol for custom type rendering, enabling developers to define how their Elixir types are logged as SQL, as shown with Postgrex structs and optional geo library support.

Cons

Type Mapping Limitations

Operates below Ecto's type casting layer, so it may not match schema types exactly; for example, maps are always rendered as JSON even if stored as hstore, requiring manual intervention for accuracy.

Complex Dev-Only Setup

Installing only in development requires additional boilerplate code in the application start function, such as conditional module checks, which adds complexity compared to standard logging setup.

PostgreSQL-Centric Bias

Many rendering examples and features are tailored for PostgreSQL (e.g., Postgrex structs, geo types), which might not seamlessly work with other databases like MySQL or SQLite without custom implementations.

Frequently Asked Questions

Quick Stats

Stars181
Forks18
Contributors0
Open Issues1
Last commit10 months ago
CreatedSince 2022

Tags

#database#elixir#telemetry#ecto#postgresql#sql-logging#development-tools#debugging

Built With

E
Ecto
P
PostgreSQL
E
Elixir
P
PostGIS
T
Telemetry

Included in

Elixir13.1k
Auto-fetched 18 hours ago

Related Projects

rollbaxrollbax

Exception tracking and logging from Elixir to Rollbar

Stars240
Forks51
Last commit2 years ago
timbertimber

🌲 Great Elixir logging made easy

Stars213
Forks29
Last commit6 years ago
logsterlogster

Easily parsable single line, plain text and JSON logger for Plug and Phoenix applications

Stars213
Forks27
Last commit1 year ago
bunyanbunyan

The all-plugins-included package of the Bunyan distributed and pluggable logging system.

Stars90
Forks1
Last commit7 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub