Esempio n. 1
0
	def run(self,ctx,**k):
		event = self.params(ctx)
		if len(event) < 1 or len(event) > 2:
			raise SyntaxError(u"Usage: log limit ‹type› ‹level›")
		name = event[0]
		if len(event) == 2:
			level = getattr(logging,event[1].upper())
			log_level(name,level)
		else:
			try:
				out = self.ctx.out
			except AttributeError:
				out = sys.stderr
			print(LogNames[log_level(name)], file=out)
Esempio n. 2
0
	def run(self,ctx,**k):
		event = self.params(ctx)
		if len(event) < 1 or len(event) > 2:
			SyntaxError(u"Usage: log limit ‹type› ‹level›")
		name = event[0]
		if len(event) == 2:
			level = getattr(logging,event[1].upper())
			log_level(name,level)
		else:
			try:
				out = self.ctx.out
			except AttributeError:
				out = sys.stderr
			print(LogNames[log_level(name)], file=out)
Esempio n. 3
0
File: main.py Progetto: smurfix/MoaT
from moat.statement import main_words, global_words
from moat.check import register_condition
from moat.module import load_module, Load,LoadDir
from moat.reactor import ShutdownHandler,mainloop,shut_down
from moat.context import Context
from moat.twist import callLater,fix_exception
from moat.logging import log_level,NONE

from tokenize import tok_name
import os,sys

main_words.register_statement(Load)
main_words.register_statement(LoadDir)
main_words.register_statement(ShutdownHandler)

log_level("token",NONE)
log_level("parser",NONE)

load_module("help")
load_module("data")
load_module("file")
load_module("path")
load_module("ifelse")

syms = {}
def parse_logger(t,*x):
	x=list(x)
	try:
		x[1] = tok_name[x[1]]
	except KeyError:
		pass
Esempio n. 4
0
try:
    from io import StringIO
except ImportError:
    from cStringIO import StringIO
import sys
import re
import os
import traceback
from time import time
from subprocess import Popen
from tokenize import tok_name

exitcode = 0

log_level("event", TRACE)
log_level("monitor", TRACE)
log_level("fs20", TRACE)
log_level("parser", NONE)
log_level("token", NONE)
log_level("msg", NONE)
log_level("wago", NONE)
log_level("conn", TRACE)

startup = now()
realStartup = now(True)


def ixtime(t=None, force=False):
    if t is None:
        t = now(force)
Esempio n. 5
0
try:
	from io import StringIO
except ImportError:
	from cStringIO import StringIO
import sys
import re
import os
import traceback
from time import time
from subprocess import Popen
from tokenize import tok_name

exitcode = 0

log_level("event",TRACE)
log_level("monitor",TRACE)
log_level("fs20",TRACE)
log_level("parser",NONE)
log_level("token",NONE)
log_level("msg",NONE)
log_level("wago",NONE)
log_level("conn",TRACE)

startup=now()
realStartup=now(True)
def ixtime(t=None,force=False):
	if t is None:
		t = now(force)
	r = unixtime(t)-unixtime(realStartup if force else startup)
	return "%.1f" % (r,)
Esempio n. 6
0
from moat.statement import main_words, global_words
from moat.check import register_condition
from moat.module import load_module, Load, LoadDir
from moat.reactor import ShutdownHandler, mainloop, shut_down
from moat.context import Context
from moat.twist import callLater, fix_exception
from moat.logging import log_level, NONE

from tokenize import tok_name
import os, sys

main_words.register_statement(Load)
main_words.register_statement(LoadDir)
main_words.register_statement(ShutdownHandler)

log_level("token", NONE)
log_level("parser", NONE)

load_module("help")
load_module("data")
load_module("file")
load_module("path")
load_module("ifelse")

syms = {}


def parse_logger(t, *x):
    x = list(x)
    try:
        x[1] = tok_name[x[1]]