Skip to content

Commit

Permalink
Merge pull request #163 from colab/new_log
Browse files Browse the repository at this point in the history
New log
  • Loading branch information
lucasmoura committed Mar 17, 2016
2 parents 58cb49f + 197a7dd commit 2f94518
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 10 deletions.
40 changes: 30 additions & 10 deletions colab/management/commands/initconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,48 @@
## Disable indexing
ROBOTS_NOINDEX = False
import sys
import os
if os.environ.get('COLAB_DEBUG') and not os.environ.get('COLAB_LOGLEVEL'):
os.environ['COLAB_LOGLEVEL'] = 'DEBUG'
LOGGING = {{
'version': 1,
'formatters': {{
'simple': {{
'format': '%(levelname)s: %(message)s'
}}
}},
'handlers': {{
'null': {{
'console': {{
'level': 'DEBUG',
'class': 'logging.NullHandler',
}},
'formatter': 'simple',
'class': 'logging.StreamHandler',
'stream': sys.stdout,
}}
}},
'loggers': {{
'colab.mailman': {{
'handlers': ['null'],
'propagate': False,
'colab': {{
'handlers': ['console'],
'level': os.environ.get('COLAB_LOGLEVEL', 'ERROR'),
}},
'django': {{
'handlers': ['console'],
'level': os.environ.get('COLAB_LOGLEVEL', 'ERROR'),
'revproxy': {{
'handlers': ['console'],
'level': os.environ.get('COLAB_LOGLEVEL', 'ERROR'),
}},
}},
'haystack': {{
'handlers': ['null'],
'handlers': ['console'],
'propagate': False,
'level': os.environ.get('COLAB_LOGLEVEL', 'ERROR'),
}},
'pysolr': {{
'handlers': ['null'],
'handlers': ['console'],
'propagate': False,
'level': os.environ.get('COLAB_LOGLEVEL', 'ERROR'),
}},
}},
}}
Expand Down
26 changes: 26 additions & 0 deletions docs/source/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ View the following file:
The file /etc/colab/settings.py have the configurations of colab, this configurations overrides the django settings.py

Colab can generate its own default settings file for development environment with

.. code-block:: shell
$ colab-admin initconfig > /etc/colab/settings.py
Colab development settings - Log Level
++++++++++++++++++

If you used the default settings file from initconfig. You can especify the environment variable **COLAB_LOGLEVEL** to set which log level you want to
show on the console.

You can also set **COLAB_DEBUG** that is an alias to *COLAB_LOGLEVEL=DEBUG*

The following log levels exist:

* **DEBUG**: Show everything possible.
* **INFO**: Show info, and errors.
* **ERROR**: Default behavior, show errors, warnings and critical messages.

Example of running runserver showing **INFO** logs:

.. code-block:: shell
$ COLAB_LOGLEVEL=INFO colab-admin runserver 0.0.0.0:8000
Widgets
-------

Expand Down

0 comments on commit 2f94518

Please sign in to comment.