datafolklabs / cement

Application Framework for Python
http://builtoncement.com
BSD 3-Clause "New" or "Revised" License
1.22k stars 120 forks source link

Cement Framework Logging to file config needed #593

Open c-w-m opened 3 years ago

c-w-m commented 3 years ago

New Feature: add log to file for Cement Framework minimal_logger. This is typically only used in development so the implementation can be very simple (i.e., environment variable much like the use of CEMENT_FRAMEWORK_LOGGING).

Suggestions: os.environ.set('CEMENT_LOGFILE') and then consume this in the misc.py class MinimalLogger(object).init to setup the log for both console and (optional) file logging.

Open to different approach, I just couldn't figure out how to wire this up via the existing config approach. For example, an option to log.colorlog that would include the Cement Framework log entries to file so both the application and the framework log is combined.

Thanks, cm

derks commented 3 years ago

Adding a CEMENT_FRAMEWORK_LOG_FILE makes complete sense, surprised nobody else has requested it. Usually I'm the only one digging into framework logs. ;)

Will add in 3.0.6 as long as there are no compat issues (shouldn't be).