Setting logging

Prevision.io’s SDK can provide with more detailed information if you change the logging level. By default, it will only output warnings and errors.

To change the logging level, use pio.verbose() method:

previsionio.__init__.verbose(v, debug: bool = False, event_log: bool = False)

Set the SDK level of verbosity.

Parameters:
  • v (bool) – Whether to activate info logging
  • debug (bool, optional) – Whether to activate detailed debug logging (default: False)
  • event_log (bool, optional) – Whether to activate detailed event managers debug logging (default: False)

For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import previsionio as pio

# CHANGE LOGGING LEVEL ------------------------------------------
pio.verbose(True, debug=True) # (add event_log=True
                              # for events logging)

# CLIENT INITIALIZATION -----------------------------------------
url = """https://<your instance>.prevision.io"""
token = """<your token>"""
pio.client.init_client(url, token)

# TESTING LOGS --------------------------------------------------
# fetching a dataset from the platform
dataset = pio.Dataset.from_id('dataset_id')

# fetching a usecase  from the platform
usecase = pio.Usecase.from_id('usecase_id')

# fetching a usecase version from the platform
usecase_version = pio.Supervised.from_id('usecase_version_id')
usecase_version = pio.Classification.from_id('usecase_version_id')

# fetching a model from the platform
model = pio.Model.from_id('helloworld classif')