log.c revision fc80027fb54b501cdd88461bf879d078259e0226
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews/*
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Copyright (C) 1999 Internet Software Consortium.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews *
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Permission to use, copy, modify, and distribute this software for any
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * purpose with or without fee is hereby granted, provided that the above
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * copyright notice and this permission notice appear in all copies.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews *
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * SOFTWARE.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews/* $Id: log.c,v 1.1 1999/09/23 17:43:50 tale Exp $ */
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff/* Principal Authors: DCL */
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff#include <isc/assertions.h>
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrews#include <isc/log.h>
3761c433912beabe43abeed2c3513b6201c59f64Mark Andrews#include <isc/result.h>
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews#include <dns/log.h>
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff#include <dns/result.h>
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews/*
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * When adding a new category, be sure to add the appropriate
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * #define to <dns/log.h>.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews */
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsisc_logcategory_t dns_categories[] = {
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews { "dns_general: ", 0 },
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews { "dns_database: ", 0 },
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews { "dns_security: ", 0 },
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews { NULL, 0 }
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews};
eb6bd543c7d072efdca509eb17f8f301c1467b53Mark Andrews
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrews/*
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrews * When adding a new module, be sure to add the appropriate
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrews * #define to <dns/log.h>.
eb6bd543c7d072efdca509eb17f8f301c1467b53Mark Andrews */
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrewsisc_logmodule_t dns_modules[] = {
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "db: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "rbtdb: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "rbtdb64: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "rbt: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "rdata: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "master: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "message: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { "cache: ", 0 },
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews { NULL, 0 }
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews};
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsisc_log_t *dns_lctx;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsdns_result_t
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdns_log_init(isc_log_t *lctx) {
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews isc_result_t result;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews REQUIRE(dns_lctx == NULL);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews result = isc_log_registercategories(lctx, dns_categories);
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews if (result == ISC_R_SUCCESS) {
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews isc_log_registermodules(lctx, dns_modules);
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews dns_lctx = lctx;
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews }
8a17d1e7cdba9fdcf71fb2f821a954a251204105Mark Andrews
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews return (result);
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews}
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews