forked from MarieluiseOden/FiLiP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging_example.py
28 lines (25 loc) · 1.24 KB
/
logging_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Example to show we can make use of python's logging when using filip.
The configuration is totally up to the user because FiLiP should not
interfere with the user's final application and preferences.
Each module has its own logger but does not configure any streams and
therefore reuses the streams of the root logger.
"""
# import python's build in logging implementation
import logging
# import an api client from filip as example
from filip.clients.ngsi_v2 import ContextBrokerClient
# setting up the basic configuration of the logging system. Please check the
# official documentation and the functions docstrings for more details.
# Handling for 'handlers' in the logging system is not trivial.
# It is also import to know that this function should only be called once in
# your application. Since FiLiP is an SDK that should help to implement other
# services we do not call this function anywhere in our code.
# Hence, it is up to the user to configure the logging system.
# In this example we will simply change the log level and the log format.
logging.basicConfig(
level='DEBUG',
format='%(asctime)s %(name)s %(levelname)s: %(message)s')
# You need to change the output
ocb = ContextBrokerClient(url='http://<PleaseChange.Me>')
ocb.get_version()