File size: 747 Bytes
6b6d936 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import datetime
import json
import sys
def debug(message):
""" Print a debug message """
now = datetime.datetime.now()
print('[{}]: {}'.format(now.strftime("%H:%M:%S"), message),
file=sys.stderr)
def error(message):
""" Print an error message and exit """
debug(message)
output({'error': message})
sys.exit(1)
def output(data):
""" Dump JSON output from a dict """
print(json.dumps(data))
|