@@ -110,15 +110,18 @@ dictConfigs are specified in JSON format with support for comments.
110110The file name in the tracker's config for the ``logging`` -> ``config``
111111setting must end with ``.json`` to choose the correct processing.
112112
113- Comments have to be in one of two forms:
113+ Comments have to be in one of two forms based on javascript line
114+ comments:
114115
115- 1. A ``# `` with preceding white space is considered a comment and is
116- stripped from the file before being passed to the json parser. This
117- is a "block comment".
116+ 1. A ``// `` possibly indented with whitespace on a line is considereda
117+ a comment and is stripped from the file before being passed to the
118+ json parser. This is a "line comment".
118119
119- 2. A ``#`` preceded by at least three
120- white space characters is stripped from the end of the line before
121- begin passed to the json parser. This is an "inline comment".
120+ 2. A ``//` with at least three white space characters before it is
121+ stripped from the end of the line before begin passed to the json
122+ parser. This is an "inline comment".
123+
124+ Block style comments are not supported.
122125
123126Other than this the file is a standard json file that matches the
124127`Configuration dictionary schema
@@ -129,9 +132,12 @@ defined in the Python documentation.
129132Example dictConfig Logging Config
130133.................................
131134
132- Note that this file is not actually JSON format as it include comments.
133- So you can not use tools that expect JSON (linters, formatters) to
134- work with it.
135+ Note that this file is not actually JSON format as it include
136+ comments. However by using javascript style comments, some tools that
137+ expect JSON (editors, linters, formatters) might work with it. A
138+ command like ``sed -e 's#^\s*//.*##' -e 's#\s*\s\s\s//.*##'
139+ logging.json`` can be used to strip comments for programs that need
140+ it.
135141
136142The config below works with the `Waitress wsgi server
137143<https://github.com/Pylons/waitress>`_ configured to use the
@@ -143,35 +149,35 @@ the tracker home. The tracker home is the subdirectory demo under the
143149current working directory. The commented config is::
144150
145151 {
146- "version": 1, # only supported version
147- "disable_existing_loggers": false, # keep the wsgi loggers
152+ "version": 1, // only supported version
153+ "disable_existing_loggers": false, // keep the wsgi loggers
148154
149155 "formatters": {
150- # standard format for Roundup messages
156+ // standard format for Roundup messages
151157 "standard": {
152- "format": "%(asctime)s %(levelname)s %(name)s:%(module)s %(msg)s"
158+ "format": "%(asctime)s %(ctx_id)s %( levelname)s %(name)s:%(module)s %(msg)s"
153159 },
154- # used for waitress wsgi server to produce httpd style logs
160+ // used for waitress wsgi server to produce httpd style logs
155161 "http": {
156162 "format": "%(message)s"
157163 }
158164 },
159165 "handlers": {
160- # create an access.log style http log file
166+ // create an access.log style http log file
161167 "access": {
162168 "level": "INFO",
163169 "formatter": "http",
164170 "class": "logging.FileHandler",
165171 "filename": "demo/access.log"
166172 },
167- # logging for roundup.* loggers
173+ // logging for roundup.* loggers
168174 "roundup": {
169175 "level": "DEBUG",
170176 "formatter": "standard",
171177 "class": "logging.FileHandler",
172178 "filename": "demo/roundup.log"
173179 },
174- # print to stdout - fall through for other logging
180+ // print to stdout - fall through for other logging
175181 "default": {
176182 "level": "DEBUG",
177183 "formatter": "standard",
@@ -187,30 +193,30 @@ current working directory. The commented config is::
187193 "level": "DEBUG",
188194 "propagate": false
189195 },
190- # used by roundup.* loggers
196+ // used by roundup.* loggers
191197 "roundup": {
192198 "handlers": [
193199 "roundup"
194200 ],
195201 "level": "DEBUG",
196- "propagate": false # note pytest testing with caplog requires
197- # this to be true
202+ "propagate": false // note pytest testing with caplog requires
203+ // this to be true
198204 },
199205 "roundup.hyperdb": {
200206 "handlers": [
201207 "roundup"
202208 ],
203- "level": "INFO", # can be a little noisy use INFO for production
209+ "level": "INFO", // can be a little noisy use INFO for production
204210 "propagate": false
205211 },
206- "roundup.wsgi": { # using the waitress framework
212+ "roundup.wsgi": { // using the waitress framework
207213 "handlers": [
208214 "roundup"
209215 ],
210216 "level": "DEBUG",
211217 "propagate": false
212218 },
213- "roundup.wsgi.translogger": { # httpd style logging
219+ "roundup.wsgi.translogger": { // httpd style logging
214220 "handlers": [
215221 "access"
216222 ],
0 commit comments