smgc commited on
Commit
e4ddb7f
1 Parent(s): e1b2102

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -20,7 +20,8 @@ class RequestFormatter(logging.Formatter):
20
  return None
21
 
22
  formatter = RequestFormatter(
23
- '%(asctime)s - %(remote_addr)s - %(url)s - %(message)s'
 
24
  )
25
 
26
  handler = TimedRotatingFileHandler('app.log', when="midnight", interval=1, backupCount=30)
@@ -124,7 +125,7 @@ def index():
124
  </style>
125
  </head>
126
  <body>
127
- <h1>Welcome to the Text-to-Image API with SiliconFlow!</h1>
128
 
129
  <h2>Usage:</h2>
130
  <ol>
@@ -211,9 +212,14 @@ def handle_request():
211
  image_data = {'data': [{'url': image_url}]}
212
 
213
  # Log the key information
214
- params = f"-s {size_param}" if size_param != "16:9" else ""
215
- params += " -o" if use_original else ""
216
- app.logger.info(f"Status: 200 - Token: {random_token[:6]}... - Params: {params} - Image URL: {image_url}")
 
 
 
 
 
217
 
218
  if stream:
219
  return stream_response(unique_id, image_data, clean_prompt, enhanced_prompt, image_size, current_timestamp, model, system_fingerprint, use_original)
 
20
  return None
21
 
22
  formatter = RequestFormatter(
23
+ '%(remote_addr)s - - [%(asctime)s] %(message)s',
24
+ datefmt='%d/%b/%Y %H:%M:%S'
25
  )
26
 
27
  handler = TimedRotatingFileHandler('app.log', when="midnight", interval=1, backupCount=30)
 
125
  </style>
126
  </head>
127
  <body>
128
+ <h1>Text-to-Image API with SiliconFlow!</h1>
129
 
130
  <h2>Usage:</h2>
131
  <ol>
 
212
  image_data = {'data': [{'url': image_url}]}
213
 
214
  # Log the key information
215
+ params = []
216
+ if size_param != "16:9":
217
+ params.append(f"-s {size_param}")
218
+ if use_original:
219
+ params.append("-o")
220
+ params_str = " ".join(params) if params else "no params"
221
+
222
+ app.logger.info(f"Status: 200 - Token: {random_token} - Model: {model} - Params: {params_str} - Image URL: {image_url}")
223
 
224
  if stream:
225
  return stream_response(unique_id, image_data, clean_prompt, enhanced_prompt, image_size, current_timestamp, model, system_fingerprint, use_original)