/usr/share/pyshared/ffc/log.py is in python-ffc 1.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | """This module provides functions used by the FFC implementation to
output messages. These may be redirected by the user of FFC.
This module reuses the corresponding log.py module from UFL which
is a wrapper for the standard Python logging module.
"""
# Copyright (C) 2009 Anders Logg
#
# This file is part of FFC.
#
# FFC is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FFC 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
#
# Modified by Kristian B. Oelgaard, 2009
#
# First added: 2009-01-12
# Last changed: 2010-02-12
# UFL modules
from ufl.log import Logger
from ufl.log import log_functions
from ufl.log import INFO, DEBUG, ERROR, CRITICAL
from ufl.common import dstr, tstr
# Create FFC logger
ffc_logger = Logger("FFC")
# Create FFC global log functions
for foo in log_functions:
exec("%s = lambda *message : ffc_logger.%s(*message)" % (foo, foo))
# Assertion, copied from UFL
def ffc_assert(condition, *message):
"Assert that condition is true and otherwise issue an error with given message."
condition or error(*message)
# Set default log level
set_level(INFO)
#--- Specialized FFC debugging tools ---
def debug_dict(d, title=""):
"Pretty-print dictionary."
if not title: title = "Dictionary"
info("")
begin(title)
info("")
for (key, value) in d.iteritems():
info(key)
info("-"*len(key))
info(str(value))
info("")
end()
def debug_ir(ir, name=""):
"Debug intermediate representation."
title = "Intermediate representation"
if name: title += " (%s)" % str(name)
debug_dict(ir, title)
def debug_code(code, name=""):
"Debug generated code."
title = "Generated code"
if name: title += " (%s)" % str(name)
debug_dict(code, title)
|