
import logging
from flask import Flask
from flask_socketio import SocketIO
from logging.handlers import RotatingFileHandler

app = Flask(__name__)
app.config.from_object('config')
app.config.from_envvar('POSIO_SETTINGS')

socketio = SocketIO(app)

from app import views

file_handler = RotatingFileHandler('posio.log', 'a', 1 * 1024 * 1024, 10)
file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
app.logger.setLevel(logging.INFO)
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.info('Startup')


import logging
from os import environ
from flask import Flask
from flask_socketio import SocketIO
from logging.handlers import RotatingFileHandler

app = Flask(__name__)
app.config.from_object('config')
# Override config if needed
if 'POSIO_SETTINGS' in environ:
    app.config.from_envvar('POSIO_SETTINGS')

socketio = SocketIO(app)

from app import views

file_handler = RotatingFileHandler('posio.log', 'a', 1 * 1024 * 1024, 10)
file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
app.logger.setLevel(logging.INFO)
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.info('Startup')

Check if custom config file is set
Check if custom config file is set

  
  import logging
+ from os import environ
  from flask import Flask
  from flask_socketio import SocketIO
  from logging.handlers import RotatingFileHandler
  
  app = Flask(__name__)
  app.config.from_object('config')
+ # Override config if needed
+ if 'POSIO_SETTINGS' in environ:
- app.config.from_envvar('POSIO_SETTINGS')
+     app.config.from_envvar('POSIO_SETTINGS')
  
  socketio = SocketIO(app)
  
  from app import views
  
  file_handler = RotatingFileHandler('posio.log', 'a', 1 * 1024 * 1024, 10)
  file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
  app.logger.setLevel(logging.INFO)
  file_handler.setLevel(logging.INFO)
  app.logger.addHandler(file_handler)
  app.logger.info('Startup')
  
Check if custom config file is set
## Code Before:

import logging
from flask import Flask
from flask_socketio import SocketIO
from logging.handlers import RotatingFileHandler

app = Flask(__name__)
app.config.from_object('config')
app.config.from_envvar('POSIO_SETTINGS')

socketio = SocketIO(app)

from app import views

file_handler = RotatingFileHandler('posio.log', 'a', 1 * 1024 * 1024, 10)
file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
app.logger.setLevel(logging.INFO)
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.info('Startup')

## Instruction:
Check if custom config file is set
## Code After:

import logging
from os import environ
from flask import Flask
from flask_socketio import SocketIO
from logging.handlers import RotatingFileHandler

app = Flask(__name__)
app.config.from_object('config')
# Override config if needed
if 'POSIO_SETTINGS' in environ:
    app.config.from_envvar('POSIO_SETTINGS')

socketio = SocketIO(app)

from app import views

file_handler = RotatingFileHandler('posio.log', 'a', 1 * 1024 * 1024, 10)
file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
app.logger.setLevel(logging.INFO)
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.info('Startup')
