Skip to content
Open
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
2 changes: 2 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ website:
menu:
- text: "Create consistent metadata for pins"
file: customize-pins-metadata.qmd
- text: "Configuring logging for pins"
file: logging-pins.qmd
- text: "pins for R"
href: https://pins.rstudio.com
target: _blank
Expand Down
27 changes: 27 additions & 0 deletions docs/logging-pins.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Configuring logging for pins
---


The pins package includes detailed logging that tracks API calls made when reading from or writing to pins boards. This logging is invaluable for debugging connection issues, understanding data flow, and monitoring API usage. To enable and configure logging, you can use Python's built-in `logging` module.


```python
import logging

# Configure pins logger
pins_logger = logging.getLogger('pins')
pins_logger.setLevel(logging.DEBUG)

# Create console handler
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
pins_logger.addHandler(handler)

# Now use pins - all API calls will be logged
import pins
```

With logging enabled, you'll see detailed information about every HTTP call made to your pins board. This includes the URL, HTTP method, headers, and response status, which can help you diagnose issues quickly.

You can extend this logger to fit your needs by adding formatters or sending all the logs to a file. To learn more about loggers, see the [Python logging documentation](https://docs.python.org/3/library/logging.html).
Loading