#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
import logging
import os
import six
import sys
# a set of lint messages that can be produced.
LEVELS = {
"DEBUG": DEBUG,
"INFO": INFO,
"WARNING": WARNING,
"ERROR": ERROR,
"CRITICAL": CRITICAL,
# we are our own reverse map
DEBUG: "DEBUG",
INFO: "INFO",
WARNING: "WARNING",
ERROR: "ERROR",
CRITICAL: "CRITICAL"
}
"""A base class for all lint messages."""
""""Inspect a given pkg.client.progress.ProgressTracker, telling it
to flush, before emitting output."""
else:
"""A class that formats log messages."""
# install our own logger, writing to stderr
# the action and manifest we expect messages from. See advise()
# when the logger is using an engine, the engine registers
# itself here
# to our private log handler
# string values for what's always stored as an integer
raise ValueError(
_("{value} is not a valid level").format(
**value))
else:
# convenience methods to log messages
"""Start a new log file"""
pass
"""Given a LintMessage message, format that object
appropriately."""
pass
"""End a log file"""
pass
"""Called to determine if this logger produced any lint
messages at a level >= its log level."""
"""Called to tell the logger to expect lint messages concerning
if action:
if manifest:
"""A basic log formatter, just prints the message."""
return
# Format the message level and message identifier
if not ignore_linted:
try:
except DuplicateLintedAttrException as err:
_("Logging error: {0}").format(
err)))
if linted_flag:
# we may have asked not to report errors
# that have been marked as pkg.linted
"pkglint001.5.report-linted")
if report and \
return
linted_msg = _(
"Linted message: {id} "
"{msg}").format(
return
# We only treat errors, and criticals as being worthy
# of a flag (pkglint returns non-zero if self.emitted)