Skip to content

Commit 13c2971

Browse files
committed
add toc entry for logging
1 parent 2b532e5 commit 13c2971

File tree

3 files changed

+79
-73
lines changed

3 files changed

+79
-73
lines changed

docs/source/cli_overview.rst

-73
Original file line numberDiff line numberDiff line change
@@ -37,79 +37,6 @@ Test your connectivity:
3737
3838
>>> aa8716be-bc74-4ffa-b838-d92e6934d224
3939
40-
Logging Level
41-
-------------
42-
43-
Log level is controlled with the environment variable `LOG_LEVEL`.
44-
45-
Typical valid values are `ERROR`, `WARNING`, `INFO`, `DEBUG` - the default value is `INFO`.
46-
47-
- `INFO` = Significant Events
48-
- `DEBUG` = API Requests
49-
50-
51-
.. code-block:: bash
52-
53-
export LOG_LEVEL=DEBUG
54-
hpecp license platform-id
55-
56-
>>> 2020-05-12 12:58:00,251 - ContainerPlatformClient - DEBUG - ContainerPlatformClient() created with username['admin']
57-
>>> 2020-05-12 12:58:00,923 - ContainerPlatformClient - DEBUG - REQ: license/get_platform_id : get https://35.163.22.120:8080/api/v1/license
58-
>>> 2020-05-12 12:58:01,571 - ContainerPlatformClient - DEBUG - RES: license/get_platform_id : get https://35.163.22.120:8080/api/v1/license : 200 {"state": "unlicensed", "_links": {"self": {"href": "/api/v1/license"}}, "uuid": "aa8716be-bc74-4ffa-b838-d92e6934d224"}
59-
>>> aa8716be-bc74-4ffa-b838-d92e6934d224
60-
61-
See https://docs.python.org/3.7/howto/logging.html for much more info on logging.
62-
63-
Logging Configuration
64-
---------------------
65-
66-
To change logging configuration, e.g. to log to a file, set the environment variable `HPECP_LOG_CONFIG_FILE` and provide a configuration file.
67-
68-
Example: `HPECP_LOG_CONFIG_FILE=~/.hpecp_logging.conf`:
69-
70-
.. code-block:: bash
71-
72-
[loggers]
73-
keys=root,HPECP_CLI
74-
75-
[handlers]
76-
keys=consoleHandler,fileHandler
77-
78-
[formatters]
79-
keys=consoleFormatter,fileFormatter
80-
81-
[logger_root]
82-
level=INFO
83-
handlers=consoleHandler,fileHandler
84-
85-
[logger_HPECP_CLI]
86-
level=DEBUG
87-
handlers=fileHandler
88-
qualname=HPECP_CLI
89-
propagate=0
90-
91-
[handler_consoleHandler]
92-
level=INFO
93-
class=StreamHandler
94-
formatter=consoleFormatter
95-
args=(os.devnull,)
96-
97-
[handler_fileHandler]
98-
level=DEBUG
99-
class=FileHandler
100-
formatter=fileFormatter
101-
args=("/MY/LOG/FILE/LOCATION/hpecp.log","a")
102-
103-
[formatter_consoleFormatter]
104-
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
105-
datefmt=
106-
107-
[formatter_fileFormatter]
108-
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
109-
datefmt=
110-
111-
See https://docs.python.org/3.7/howto/logging.html for much more info on logging.
112-
11340
11441
CLI Help
11542
--------

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Contents
9292
installation
9393
hpecp
9494
cli_overview
95+
logging
9596
github
9697
license
9798

docs/source/logging.rst

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Logging
2+
=======
3+
4+
Logging level
5+
-------------
6+
7+
Log level is controlled with the environment variable `LOG_LEVEL`.
8+
9+
Typical valid values are `ERROR`, `WARNING`, `INFO`, `DEBUG` - the default value is `INFO`.
10+
11+
- `INFO` = Significant Events
12+
- `DEBUG` = API Requests
13+
14+
15+
.. code-block:: bash
16+
17+
export LOG_LEVEL=DEBUG
18+
hpecp license platform-id
19+
20+
>>> 2020-05-12 12:58:00,251 - ContainerPlatformClient - DEBUG - ContainerPlatformClient() created with username['admin']
21+
>>> 2020-05-12 12:58:00,923 - ContainerPlatformClient - DEBUG - REQ: license/get_platform_id : get https://35.163.22.120:8080/api/v1/license
22+
>>> 2020-05-12 12:58:01,571 - ContainerPlatformClient - DEBUG - RES: license/get_platform_id : get https://35.163.22.120:8080/api/v1/license : 200 {"state": "unlicensed", "_links": {"self": {"href": "/api/v1/license"}}, "uuid": "aa8716be-bc74-4ffa-b838-d92e6934d224"}
23+
>>> aa8716be-bc74-4ffa-b838-d92e6934d224
24+
25+
See https://docs.python.org/3.7/howto/logging.html for much more info on logging.
26+
27+
28+
Logging Configuration
29+
---------------------
30+
31+
To change logging configuration, e.g. to log to a file, set the environment variable `HPECP_LOG_CONFIG_FILE` and provide a configuration file.
32+
33+
Example: `HPECP_LOG_CONFIG_FILE=~/.hpecp_logging.conf`:
34+
35+
.. code-block:: bash
36+
37+
[loggers]
38+
keys=root,HPECP_CLI
39+
40+
[handlers]
41+
keys=consoleHandler,fileHandler
42+
43+
[formatters]
44+
keys=consoleFormatter,fileFormatter
45+
46+
[logger_root]
47+
level=INFO
48+
handlers=consoleHandler,fileHandler
49+
50+
[logger_HPECP_CLI]
51+
level=DEBUG
52+
handlers=fileHandler
53+
qualname=HPECP_CLI
54+
propagate=0
55+
56+
[handler_consoleHandler]
57+
level=INFO
58+
class=StreamHandler
59+
formatter=consoleFormatter
60+
args=(os.devnull,)
61+
62+
[handler_fileHandler]
63+
level=DEBUG
64+
class=FileHandler
65+
formatter=fileFormatter
66+
args=("/MY/LOG/FILE/LOCATION/hpecp.log","a")
67+
68+
[formatter_consoleFormatter]
69+
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
70+
datefmt=
71+
72+
[formatter_fileFormatter]
73+
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
74+
datefmt=
75+
76+
See https://docs.python.org/3.7/howto/logging.html for much more info on logging.
77+
78+

0 commit comments

Comments
 (0)