@@ -615,7 +615,10 @@ def read_log(
615615 search : Optional [str ] = None ,
616616 sort : Optional [str ] = None ,
617617 ) -> Result [Json ]:
618- """Read the global log from server.
618+ """Read the global log from server. This method is deprecated
619+ in ArangoDB 3.8 and will be removed in a future version
620+ of the driver. Use :func:`arango.database.Database.read_log_entries`
621+ instead.
619622
620623 :param upto: Return the log entries up to the given level (mutually
621624 exclusive with parameter **level**). Allowed values are "fatal",
@@ -642,6 +645,9 @@ def read_log(
642645 :rtype: dict
643646 :raise arango.exceptions.ServerReadLogError: If read fails.
644647 """
648+ m = "read_log() is deprecated in ArangoDB 3.8 and will be removed in a future version of the driver. Use read_log_entries() instead." # noqa: E501
649+ warn (m , DeprecationWarning , stacklevel = 2 )
650+
645651 params = dict ()
646652 if upto is not None :
647653 params ["upto" ] = upto
@@ -671,6 +677,78 @@ def response_handler(resp: Response) -> Json:
671677
672678 return self ._execute (request , response_handler )
673679
680+ def read_log_entries (
681+ self ,
682+ upto : Optional [Union [int , str ]] = None ,
683+ level : Optional [Union [int , str ]] = None ,
684+ start : Optional [int ] = None ,
685+ size : Optional [int ] = None ,
686+ offset : Optional [int ] = None ,
687+ search : Optional [str ] = None ,
688+ sort : Optional [str ] = None ,
689+ server_id : Optional [str ] = None ,
690+ ) -> Result [Json ]:
691+ """Read the global log from server.
692+
693+ :param upto: Return the log entries up to the given level (mutually
694+ exclusive with parameter **level**). Allowed values are "fatal",
695+ "error", "warning", "info" (default) and "debug".
696+ :type upto: int | str
697+ :param level: Return the log entries of only the given level (mutually
698+ exclusive with **upto**). Allowed values are "fatal", "error",
699+ "warning", "info" (default) and "debug".
700+ :type level: int | str
701+ :param start: Return the log entries whose ID is greater or equal to
702+ the given value.
703+ :type start: int
704+ :param size: Restrict the size of the result to the given value. This
705+ can be used for pagination.
706+ :type size: int
707+ :param offset: Number of entries to skip (e.g. for pagination).
708+ :type offset: int
709+ :param search: Return only the log entries containing the given text.
710+ :type search: str
711+ :param sort: Sort the log entries according to the given fashion, which
712+ can be "sort" or "desc".
713+ :type sort: str
714+ :param server_id: Returns all log entries of the specified server.
715+ All other query parameters remain valid. If no serverId is given,
716+ the asked server will reply. This parameter is only meaningful
717+ on Coordinators.
718+ :type server_id: str
719+ :return: Server log entries.
720+ :rtype: dict
721+ :raise arango.exceptions.ServerReadLogError: If read fails.
722+ """
723+ params = dict ()
724+ if upto is not None :
725+ params ["upto" ] = upto
726+ if level is not None :
727+ params ["level" ] = level
728+ if start is not None :
729+ params ["start" ] = start
730+ if size is not None :
731+ params ["size" ] = size
732+ if offset is not None :
733+ params ["offset" ] = offset
734+ if search is not None :
735+ params ["search" ] = search
736+ if sort is not None :
737+ params ["sort" ] = sort
738+ if server_id is not None :
739+ params ["serverId" ] = server_id
740+
741+ request = Request (method = "get" , endpoint = "/_admin/log/entries" , params = params )
742+
743+ def response_handler (resp : Response ) -> Json :
744+ if not resp .is_success :
745+ raise ServerReadLogError (resp , request )
746+
747+ result : Json = resp .body
748+ return result
749+
750+ return self ._execute (request , response_handler )
751+
674752 def log_levels (self , server_id : Optional [str ] = None ) -> Result [Json ]:
675753 """Return current logging levels.
676754
0 commit comments