| Server IP : 104.21.21.239 / Your IP : 216.73.217.39 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.9/site-packages/awscli/autoprompt/ |
Upload File : |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import logging
from prompt_toolkit.application import get_app
from prompt_toolkit.document import Document
class PromptToolkitHandler(logging.StreamHandler):
def emit(self, record):
try:
app = get_app()
if app.is_running and getattr(app, 'debug', False):
msg = self.format(record)
debug_buffer = app.layout.get_buffer_by_name('debug_buffer')
current_document = debug_buffer.document.text
if current_document:
msg = '\n'.join([current_document, msg])
debug_buffer.set_document(
Document(text=msg), bypass_readonly=True
)
else:
super().emit(record)
except:
self.handleError(record)