def fetch(self, log_group_name, start=None, end=None, filter_pattern=None):
kwargs = {<EOL>"<STR_LIT>": log_group_name,<EOL>"<STR_LIT>": True<EOL>}<EOL>if start:<EOL><INDENT>kwargs["<STR_LIT>"] = to_timestamp(start)<EOL><DEDENT>if end:<EOL><INDENT>kwargs["<STR_LIT>"] = to_timestamp(end)<EOL><DEDENT>if filter_pattern:<EOL><INDENT>kwargs["<STR_LIT>"] = filter_pattern<EOL><DEDENT>while True:<EOL><INDENT>LOG.debug("<STR_LIT>", kwargs)<EOL>result = self.cw_client.filter_log_events(**kwargs)<EOL>for event in result.get('<STR_LIT>', []):<EOL><INDENT>yield LogEvent(log_group_name, event)<EOL><DEDENT>next_token = result.get("<STR_LIT>", None)<EOL>kwargs["<STR_LIT>"] = next_token<EOL>if not next_token:<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Fetch logs from all streams under the given CloudWatch Log Group and yields in the output. Optionally, caller
can filter the logs using a pattern or a start/end time.

Parameters
----------
log_group_name : string
    Name of CloudWatch Logs Group to query.

start : datetime.datetime
    Optional start time for logs.

end : datetime.datetime
    Optional end time for logs.

filter_pattern : str
    Expression to filter the logs by. This is passed directly to CloudWatch, so any expression supported by
    CloudWatch Logs API is supported here.

Yields
------

samcli.lib.logs.event.LogEvent
    Object containing the information from each log event returned by CloudWatch Logs