Changeset - 609d52bbf917
[Not reviewed]
default
0 3 0
Mads Kiilerich - 6 years ago 2019-07-31 02:55:22
mads@kiilerich.com
ini: create separate log handlers for color and null, and add comments hinting how they can be used

Let development.ini use color for the root logger as before. The special effect
of color_sql was not visible with the default sqlalchemy log level of WARN, so
just use color there as well.
3 files changed with 45 insertions and 17 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -356,7 +356,7 @@ script_location = kallithea:alembic
 
keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash
 

	
 
[handlers]
 
keys = console, console_sql
 
keys = console, console_color, console_color_sql, null
 

	
 
[formatters]
 
keys = generic, color_formatter, color_formatter_sql
 
@@ -367,7 +367,10 @@ keys = generic, color_formatter, color_f
 

	
 
[logger_root]
 
level = NOTSET
 
handlers = console
 
#handlers = console
 
handlers = console_color
 
# For coloring based on log level:
 
# handlers = console_color
 

	
 
[logger_routes]
 
#level = WARN
 
@@ -408,9 +411,12 @@ qualname = gearbox
 

	
 
[logger_sqlalchemy]
 
level = WARN
 
handlers = console_sql
 
handlers =
 
qualname = sqlalchemy.engine
 
propagate = 0
 
# For coloring based on log level and pretty printing of SQL:
 
# level = INFO
 
# handlers = console_color_sql
 
# propagate = 0
 

	
 
[logger_whoosh_indexer]
 
#level = WARN
 
@@ -435,15 +441,24 @@ qualname = backlash
 
[handler_console]
 
class = StreamHandler
 
args = (sys.stderr,)
 
#formatter = generic
 
formatter = generic
 

	
 
[handler_console_color]
 
# ANSI color coding based on log level
 
class = StreamHandler
 
args = (sys.stderr,)
 
formatter = color_formatter
 

	
 
[handler_console_sql]
 
[handler_console_color_sql]
 
# ANSI color coding and pretty printing of SQL statements
 
class = StreamHandler
 
args = (sys.stderr,)
 
#formatter = generic
 
formatter = color_formatter_sql
 

	
 
[handler_null]
 
class = NullHandler
 
args = ()
 

	
 
################
 
## FORMATTERS ##
 
################
kallithea/lib/paster_commands/template.ini.mako
Show inline comments
 
@@ -537,7 +537,7 @@ script_location = kallithea:alembic
 
keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash
 

	
 
[handlers]
 
keys = console, console_sql
 
keys = console, console_color, console_color_sql, null
 

	
 
[formatters]
 
keys = generic, color_formatter, color_formatter_sql
 
@@ -549,6 +549,8 @@ keys = generic, color_formatter, color_f
 
[logger_root]
 
level = NOTSET
 
handlers = console
 
# For coloring based on log level:
 
# handlers = console_color
 

	
 
[logger_routes]
 
level = WARN
 
@@ -583,9 +585,12 @@ qualname = gearbox
 

	
 
[logger_sqlalchemy]
 
level = WARN
 
handlers = console_sql
 
handlers =
 
qualname = sqlalchemy.engine
 
propagate = 0
 
# For coloring based on log level and pretty printing of SQL:
 
# level = INFO
 
# handlers = console_color_sql
 
# propagate = 0
 

	
 
[logger_whoosh_indexer]
 
level = WARN
 
@@ -611,10 +616,21 @@ class = StreamHandler
 
args = (sys.stderr,)
 
formatter = generic
 

	
 
[handler_console_sql]
 
[handler_console_color]
 
# ANSI color coding based on log level
 
class = StreamHandler
 
args = (sys.stderr,)
 
formatter = generic
 
formatter = color_formatter
 

	
 
[handler_console_color_sql]
 
# ANSI color coding and pretty printing of SQL statements
 
class = StreamHandler
 
args = (sys.stderr,)
 
formatter = color_formatter_sql
 

	
 
[handler_null]
 
class = NullHandler
 
args = ()
 

	
 
<%text>################</%text>
 
<%text>## FORMATTERS ##</%text>
scripts/generate-ini.py
Show inline comments
 
@@ -19,11 +19,8 @@ ini_files = [
 
                'app_instance_uuid': 'development-not-secret',
 
                'session.secret': 'development-not-secret',
 
            },
 
            '[handler_console]': {
 
                'formatter': 'color_formatter',
 
            },
 
            '[handler_console_sql]': {
 
                'formatter': 'color_formatter_sql',
 
            '[logger_root]': {
 
                'handlers': 'console_color',
 
            },
 
            '[logger_routes]': {
 
                'level': 'DEBUG',
0 comments (0 inline, 0 general)