Skip to content

Commit

Permalink
added logging redirecting docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran94 committed May 3, 2021
1 parent 36181ce commit 1339436
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,20 @@ logging.getLogger('dgraphpandas.writers.schema').setLevel(logging.DEBUG)
# your logic
dpd.to_rdf('input.csv', config, 'config_key')
```

Naturally this means that you can redirect logs to any handler you would like:

```py
logging_file = 'dgraphpandas.log'

logging.basicConfig()
rdf_logger = logging.getLogger('dgraphpandas.rdf')
rdf_logger.setLevel(logging.DEBUG)

# Create and add any Handler
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler = logging.FileHandler(logging_file)
file_handler.setFormatter(formatter)

rdf_logger.addHandler(file_handler)
```

0 comments on commit 1339436

Please sign in to comment.