This project is not covered by Drupal’s security advisory policy.
Introduction
The Logger module provides event logging facilities that are decoupled from any particular storage backend. It is useful for module developers who want to instrument their code for monitoring and alerting without forcing their users to use a particular backend technology, like StatsD. The module doesn't provide any visible functionality out-of-the-box. You only need it if you're a module developer looking to instrument your code or if a module you're using depends on it.
Installation
Logger itself is installed in the usual way. See Installing contributed modules. An implementation of hook_logger_event()
is required to connect to a logging backend so as to actually do something with event data. See logger.api.php. This implementation may be supplied in custom code or by a contributed module like StatsD.
Instrumentation
Instrumentation is the process of adding "probes" to your application code to fire events for Logger to log. If you're installing Logger as a dependency of another module, presumably that module is already instrumented. To instrument your own code, simply invoke logger_event()
, much as you would watchdog()
. See logger.module.
If you're instrumenting a contributed module, you must declare a dependency on Logger in your .info file. Alternatively, you can create a "soft", or optional, dependency on Logger by using a wrapping function instead of calling logger_event()
directly, like this:
function example_logger_event($name, $type = 'count', $value = 1) {
if (function_exists('logger_event')) {
logger_event($name, $type, $value);
}
}
Event names should be Graphite-compatible, i.e., paths delimited by dots (.
). See Getting Your Data Into Graphite: Step 1 for some helpful advice.
Note: Logger has a debug mode that logs events to watchdog, which can be helpful during development. It can be enabled at admin/config/development/logging
or by setting the logger_debug
variable directly, e.g.:
# Enable debugging.
drush variable-set --exact logger_debug 1
# Disable debugging.
drush variable-delete --exact logger_debug
Code
The source code for Logger is hosted on GitHub at https://github.com/WhiteHouse/logger and mirrored here for convenience.
Issues should be filed on the GitHub tracker.
Contributing
Anyone is encouraged to contribute to this project.
By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the Gnu General Public License v2 or later.
All comments, messages, pull requests, and other submissions received through official White House pages including this Drupal.org page are subject to the Presidential Records Act and may be archived. Learn more http://WhiteHouse.gov/privacy
License
This project constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105.
The project utilizes code licensed under the terms of the GNU General Public License and therefore is licensed under GPL v2 or later.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Project information
- Module categories: Developer Tools, Integrations
- 1 site reports using this module
- Created by Yoran on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
Adding file path and line number to thrown InvalidArgumentException to aid debugging.