summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/msg.py
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-11-16 15:02:15 +0000
committerRichard Purdie <richard@openedhand.com>2006-11-16 15:02:15 +0000
commit306b7c7a9757ead077363074e7bbac2e5c03e7c5 (patch)
tree6935017a9af749c46816881c86258f514384ba1c /bitbake/lib/bb/msg.py
parent65930a38e415ae4a0182e1cea1be838e0ada50ee (diff)
downloadpoky-306b7c7a9757ead077363074e7bbac2e5c03e7c5.tar.gz
bitbake: Upgrade from 1.4 -> 1.7.4ish
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@863 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/msg.py')
-rw-r--r--bitbake/lib/bb/msg.py108
1 files changed, 108 insertions, 0 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
new file mode 100644
index 0000000000..473851cc72
--- /dev/null
+++ b/bitbake/lib/bb/msg.py
@@ -0,0 +1,108 @@
1#!/usr/bin/env python
2# ex:ts=4:sw=4:sts=4:et
3# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4"""
5BitBake 'msg' implementation
6
7Message handling infrastructure for bitbake
8
9# Copyright (C) 2006 Richard Purdie
10
11This program is free software; you can redistribute it and/or modify it under
12the terms of the GNU General Public License as published by the Free Software
13Foundation; either version 2 of the License, or (at your option) any later
14version.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License along with
21this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22Place, Suite 330, Boston, MA 02111-1307 USA.
23
24"""
25
26import sys, os, re, bb
27from bb import utils
28
29debug_level = {}
30
31verbose = False
32
33domain = bb.utils.Enum(
34 'Build',
35 'Cache',
36 'Collection',
37 'Data',
38 'Depends',
39 'Fetcher',
40 'Parsing',
41 'Provider',
42 'RunQueue',
43 'TaskData',
44 'Util')
45
46#
47# Message control functions
48#
49
50def set_debug_level(level):
51 bb.msg.debug_level = {}
52 for domain in bb.msg.domain:
53 bb.msg.debug_level[domain] = level
54 bb.msg.debug_level['default'] = level
55
56def set_verbose(level):
57 bb.msg.verbose = level
58
59def set_debug_domains(domains):
60 for domain in domains:
61 found = False
62 for ddomain in bb.msg.domain:
63 if domain == str(ddomain):
64 bb.msg.debug_level[ddomain] = bb.msg.debug_level[ddomain] + 1
65 found = True
66 if not found:
67 std_warn("Logging domain %s is not valid, ignoring" % domain)
68
69#
70# Message handling functions
71#
72
73def debug(level, domain, msg, fn = None):
74 if debug_level[domain] >= level:
75 print 'DEBUG: ' + msg
76
77def note(level, domain, msg, fn = None):
78 if level == 1 or verbose or debug_level[domain] >= 1:
79 std_note(msg)
80
81def warn(domain, msg, fn = None):
82 std_warn(msg)
83
84def error(domain, msg, fn = None):
85 std_error(msg)
86
87def fatal(domain, msg, fn = None):
88 std_fatal(msg)
89
90#
91# Compatibility functions for the original message interface
92#
93def std_debug(lvl, msg):
94 if debug_level['default'] >= lvl:
95 print 'DEBUG: ' + msg
96
97def std_note(msg):
98 print 'NOTE: ' + msg
99
100def std_warn(msg):
101 print 'WARNING: ' + msg
102
103def std_error(msg):
104 print 'ERROR: ' + msg
105
106def std_fatal(msg):
107 print 'ERROR: ' + msg
108 sys.exit(1)