-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from cheerfulstoic/debug-logs
feat: Add debug logging option
- Loading branch information
Showing
8 changed files
with
262 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
It is possible to get debug logs from EctoWatch by setting the `debug?` option, either globally: | ||
|
||
```elixir | ||
# setup | ||
{EctoWatch, | ||
repo: MyApp.Repo, | ||
pub_sub: MyApp.PubSub, | ||
debug?: true | ||
watchers: [ | ||
# ... | ||
{Comment, :deleted, extra_columns: [:post_id]}, | ||
# ... | ||
]} | ||
``` | ||
|
||
Or on specific watchers: | ||
|
||
```elixir | ||
# setup | ||
{EctoWatch, | ||
repo: MyApp.Repo, | ||
pub_sub: MyApp.PubSub, | ||
watchers: [ | ||
# ... | ||
{Comment, :deleted, debug?: true, extra_columns: [:post_id]}, | ||
# ... | ||
]} | ||
``` | ||
|
||
Debug logs will be written to the `:debug` log level. They will output when: | ||
|
||
* A watcher server is starting up | ||
* A watcher server receives a message from PostgreSQL via a `pg_notify` channel | ||
* A watcher server broadcasts a message to `Phoenix.PubSub` | ||
* A process subscribes to a watcher | ||
|
||
All debug logs have a PID associated as well as the identifier for the watcher server (either the label or a `{ecto_schema, update_type}` tuple). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.