8
8
9
9
from datetime import datetime
10
10
from numbers import Number
11
- from typing import Any , List , Optional , Sequence , Union
11
+ from typing import Any , Dict , List , Optional , Sequence , Union
12
12
from warnings import warn
13
13
14
14
from arango .api import ApiGroup
48
48
ServerLicenseSetError ,
49
49
ServerLogLevelError ,
50
50
ServerLogLevelSetError ,
51
+ ServerLogSettingError ,
52
+ ServerLogSettingSetError ,
51
53
ServerMetricsError ,
52
54
ServerReadLogError ,
53
55
ServerReloadRoutingError ,
@@ -749,6 +751,52 @@ def response_handler(resp: Response) -> Json:
749
751
750
752
return self ._execute (request , response_handler )
751
753
754
+ def log_settings (self ) -> Result [Json ]:
755
+ """Return the structured log settings.
756
+
757
+ :return: Current log settings. False values are not returned.
758
+ :rtype: dict
759
+ """
760
+ request = Request (method = "get" , endpoint = "/_admin/log/structured" )
761
+
762
+ def response_handler (resp : Response ) -> Json :
763
+ if not resp .is_success :
764
+ raise ServerLogSettingError (resp , request )
765
+ result : Json = resp .body
766
+ return result
767
+
768
+ return self ._execute (request , response_handler )
769
+
770
+ def set_log_settings (self , ** kwargs : Dict [str , Any ]) -> Result [Json ]:
771
+ """Set the structured log settings.
772
+
773
+ This method takes arbitrary keyword arguments where the keys are the
774
+ structured log parameters and the values are true or false, for either
775
+ enabling or disabling the parameters.
776
+
777
+ .. code-block:: python
778
+
779
+ arango.set_log_settings(
780
+ database=True,
781
+ url=True,
782
+ username=False,
783
+ )
784
+
785
+ :param kwargs: Structured log parameters.
786
+ :type kwargs: Dict[str, Any]
787
+ :return: New log settings. False values are not returned.
788
+ :rtype: dict
789
+ """
790
+ request = Request (method = "put" , endpoint = "/_admin/log/structured" , data = kwargs )
791
+
792
+ def response_handler (resp : Response ) -> Json :
793
+ if not resp .is_success :
794
+ raise ServerLogSettingSetError (resp , request )
795
+ result : Json = resp .body
796
+ return result
797
+
798
+ return self ._execute (request , response_handler )
799
+
752
800
def log_levels (self , server_id : Optional [str ] = None ) -> Result [Json ]:
753
801
"""Return current logging levels.
754
802
@@ -775,7 +823,7 @@ def response_handler(resp: Response) -> Json:
775
823
return self ._execute (request , response_handler )
776
824
777
825
def set_log_levels (
778
- self , server_id : Optional [str ] = None , ** kwargs : str
826
+ self , server_id : Optional [str ] = None , ** kwargs : Dict [ str , Any ]
779
827
) -> Result [Json ]:
780
828
"""Set the logging levels.
781
829
@@ -797,6 +845,8 @@ def set_log_levels(
797
845
JWT authentication whereas Coordinators also support authentication
798
846
using usernames and passwords.
799
847
:type server_id: str | None
848
+
E864
:param kwargs: Logging levels.
849
+ :type kwargs: Dict[str, Any]
800
850
:return: New logging levels.
801
851
:rtype: dict
802
852
"""
0 commit comments