annotate orpg/tools/orpg_log.py @ 66:c54768cffbd4 ornery-dev

Traipse Dev 'OpenRPG' {090818-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user. Update Summary: *Unstable* This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author sirebral
date Tue, 18 Aug 2009 06:33:37 -0500
parents cab94a90f9dc
children dd4be4817377
rev   line source
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
2 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
3 # openrpg-dev@lists.sourceforge.net
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
4 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
8 # (at your option) any later version.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
9 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
13 # GNU General Public License for more details.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
14 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
18 # --
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
19 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
20 # File: orpg_log.py
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
21 # Author: Dj Gilcrease
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
22 # Maintainer:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
23 # Version:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
24 # $Id: orpg_log.py,v 1.9 2007/05/06 16:43:02 digitalxero Exp $
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
25 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
26 # Description: classes for orpg log messages
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
27 #
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
28 from __future__ import with_statement
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
29 import sys
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
30 import os, os.path
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
31 import time
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
32
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
33 from orpg.external.terminalwriter import TerminalWriter
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
34 from orpg.tools.decorators import pending_deprecation
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
35 from orpg.dirpath import dir_struct
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
36
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
37 #########################
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
38 ## Error Types
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
39 #########################
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
40 ORPG_CRITICAL = 1
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
41 ORPG_GENERAL = 2
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
42 ORPG_INFO = 4
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
43 ORPG_NOTE = 8
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
44 ORPG_DEBUG = 16
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
45
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
46 class orpgLog(object):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
47 _log_level = 7
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
48 _log_name = None
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
49 _log_to_console = False
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
50 _io = TerminalWriter(sys.stderr)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
51 _lvl_args = None
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
52
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
53 def __new__(cls, *args, **kwargs):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
54 it = cls.__dict__.get("__it__")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
55 if it is not None:
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
56 return it
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
57 cls.__it__ = it = object.__new__(cls)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
58 return it
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
59
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
60 def __init__(self, home_dir, filename='orpgRunLog '):
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
61 self._lvl_args = {16: {'colorizer': {'green': True},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
62 'log_string': 'DEBUG'},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
63 8: {'colorizer': {'bold': True, 'green':True},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
64 'log_string':'NOTE'},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
65 4: {'colorizer': {'blue': True},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
66 'log_string': 'INFO'},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
67 2: {'colorizer': {'red': True},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
68 'log_string': 'ERROR'},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
69 1: {'colorizer': {'bold': True, 'red': True},
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
70 'log_string': 'EXCEPTION'}}
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
71 if not self.log_name:
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
72 self.log_name = home_dir + filename + time.strftime('%m-%d-%Y.txt',
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
73 time.localtime(time.time()))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
74
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
75 def debug(self, msg, to_console=False):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
76 self.log(msg, ORPG_DEBUG, to_console)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
77
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
78 def note(self, msg, to_console=False):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
79 self.log(msg, ORPG_NOTE, to_console)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
80
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
81 def info(self, msg, to_console=False):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
82 self.log(msg, ORPG_INFO, to_console)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
83
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
84 def general(self, msg, to_console=False):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
85 self.log(msg, ORPG_GENERAL, to_console)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
86
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
87 def exception(self, msg, to_console=True):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
88 self.log(msg, ORPG_CRITICAL, to_console)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
89
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
90 def log(self, msg, log_type, to_console=False):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
91 if self.log_to_console or to_console or log_type == ORPG_CRITICAL:
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
92 self._io.line(str(msg), **self._lvl_args[log_type]['colorizer'])
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
93
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
94
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
95 if log_type & self.log_level or to_console:
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
96 atr = {'msg': msg, 'level': self._lvl_args[log_type]['log_string']}
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
97 atr['time'] = time.strftime('[%x %X]', time.localtime(time.time()))
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
98 logMsg = '%(time)s (%(level)s) - %(msg)s\n' % (atr)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
99
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
100 with open(self.log_name, 'a') as f:
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
101 f.write(logMsg)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
102
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
103 @pending_deprecation("use logger.log_level = #")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
104 def setLogLevel(self, log_level):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
105 self.log_level = log_level
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
106
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
107 @pending_deprecation("use logger.log_level")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
108 def getLogLevel(self):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
109 return self.log_level
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
110
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
111 @pending_deprecation("use logger.log_name = bla")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
112 def setLogName(self, log_name):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
113 self.log_name = log_name
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
114
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
115 @pending_deprecation("use logger.log_name")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
116 def getLogName(self):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
117 return self.log_name
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
118
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
119 @pending_deprecation("use logger.log_to_console = True/False")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
120 def setLogToConsol(self, true_or_false):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
121 self.log_to_consol = true_or_false
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
122
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
123 @pending_deprecation("use logger.log_to_console")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
124 def getLogToConsol(self):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
125 return self.log_to_consol
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
126
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
127 """
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
128 Property Methods
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
129 """
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
130 def _get_log_level(self):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
131 return self._log_level
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
132 def _set_log_level(self, log_level):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
133 if not isinstance(log_level, int) or log_level < 1 or log_level > 31:
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
134 raise TypeError("The loggers level must be an int between 1 and 31")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
135
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
136 self._log_level = log_level
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
137
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
138 def _get_log_name(self):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
139 return self._log_name
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
140 def _set_log_name(self, name):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
141 if not os.access(os.path.abspath(os.path.dirname(name)), os.W_OK):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
142 raise IOError("Could not write to the specified location")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
143
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
144 self._log_name = name
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
145
66
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
146 def _get_log_to_console(self):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
147 return self._log_to_console
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
148 def _set_log_to_console(self, true_or_false):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
149 if not isinstance(true_or_false, bool):
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
150 raise TypeError("log_to_console must be a boolean value")
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
151
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
152 self._log_to_console = true_or_false
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
153
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
154 log_level = property(_get_log_level, _set_log_level)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
155 log_name = property(_get_log_name, _set_log_name)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
156 log_to_console = property(_get_log_to_console, _set_log_to_console)
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
157
c54768cffbd4 Traipse Dev 'OpenRPG' {090818-00}
sirebral
parents: 15
diff changeset
158 logger = orpgLog(dir_struct.get("user") + "runlogs/")