|
2 | 2 | Miscellaneous |
3 | 3 | ============= |
4 | 4 |
|
5 | | -Logging |
6 | | -======= |
7 | | - |
8 | | -This library features numerous console loggers, with an option to redirect the output to a file. |
9 | | - |
10 | | - +--------------------------------+---------+--------------------------------------+ |
11 | | - |Logger name |Level |Description | |
12 | | - +================================+=========+======================================+ |
13 | | - |cterasdk |NOTSET |Package Logger | |
14 | | - +--------------------------------+---------+--------------------------------------+ |
15 | | - |cterasdk.edge |INFO |Logger for CTERA Edge and Drive App | |
16 | | - +--------------------------------+---------+--------------------------------------+ |
17 | | - |cterasdk.core |INFO |Logger for CTERA Portal | |
18 | | - +--------------------------------+---------+--------------------------------------+ |
19 | | - |cterasdk.common |INFO |Common Infrastructure Logger | |
20 | | - +--------------------------------+---------+--------------------------------------+ |
21 | | - |cterasdk.metadata.connector |INFO |Notification Service Logger | |
22 | | - +--------------------------------+---------+--------------------------------------+ |
23 | | - |cterasdk.http |ERROR |Transport Layer Logger | |
24 | | - +--------------------------------+---------+--------------------------------------+ |
25 | | - |cterasdk.http.trace |ERROR |Transport Layer Tracing | |
26 | | - +--------------------------------+---------+--------------------------------------+ |
27 | | - |cterasdk.crypto |ERROR |Cryptography Logger | |
28 | | - +--------------------------------+---------+--------------------------------------+ |
29 | | - |cterasdk.filesystem |ERROR |Local File System Logger | |
30 | | - +--------------------------------+---------+--------------------------------------+ |
31 | | - |
32 | | -List the available loggers: |
33 | | - |
34 | | -.. code:: python |
35 | | -
|
36 | | - import logging |
37 | | - import cterasdk.logging |
38 | | -
|
39 | | - print({name: logging.getLevelName(logging.getLogger(name).level) for name in logging.root.manager.loggerDict}) |
40 | | -
|
41 | | -To update the log level of a logger: |
42 | | - |
43 | | -.. code:: python |
44 | | -
|
45 | | - import logging |
46 | | - import cterasdk.logging |
47 | | -
|
48 | | - logging.getLogger('cterasdk.metadata.connector').setLevel(logging.DEBUG) # Enables 'DEBUG' |
49 | | -
|
50 | | -Redirecting log output to a file: |
51 | | - |
52 | | -.. code:: console |
53 | | -
|
54 | | - set cterasdk.log=cterasdk.log # Redirect output to 'cterasdk.log' in the current directory |
55 | | -
|
56 | | - set cterasdk.log=C:/users/username/Desktop/cterasdk.log # Redirect output to an alternate location |
57 | | -
|
58 | | -.. code:: bash |
59 | | -
|
60 | | - export cterasdk.log="cterasdk.log" |
61 | | -
|
62 | | - export cterasdk.log="/home/username/cterasdk.log" |
63 | | -
|
64 | | -
|
65 | 5 | Auditing |
66 | 6 | ======== |
67 | 7 |
|
|
0 commit comments