# Path: moa/sysConf.py
# USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
#                               '.config', 'moa', 'config')
# SYSCONFIGFILE = os.path.join('etc', 'moa', 'config')
# def _interpret_var(v):
#     def __init__(self):
#     def getUser(self):
#     def saveUser(self, conf):
#     def getVersion(self):
# class SysConf(Yaco.Yaco):


import os
import sys
import MySQLdb
import socket
import getpass
import moa.job
import moa.utils
import moa.logger as l
from datetime import datetime
from moa.sysConf import sysConf
# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
# 
# This file is part of Moa - http://github.com/mfiers/Moa
# 
# Licensed under the GPL license (see 'COPYING')
# 
"""
**remoteLogger** - Remotely log Moa activity
--------------------------------------------

requires the standard moa logger to be active
"""




SQL = """
INSERT INTO log (status, start, stop, level, command, full_command, wd, server, template, user, title)
VALUES (%(status)s, %(start)s, %(stop)s, %(level)s, 
        %(command)s, %(full_command)s, %(wd)s, %(server)s,
        %(template)s, %(user)s, %(title)s
        )
"""

def hook_logMessage():
    """
    Restore the log message -  this time in a remote mysql database
    """

# Path: moa/sysConf.py
# USERCONFIGFILE = os.path.join(os.path.expanduser('~'),
#                               '.config', 'moa', 'config')
# SYSCONFIGFILE = os.path.join('etc', 'moa', 'config')
# def _interpret_var(v):
#     def __init__(self):
#     def getUser(self):
#     def saveUser(self, conf):
#     def getVersion(self):
# class SysConf(Yaco.Yaco):


# Path: moa/plugin/system/remoteLogger.py
import os
import sys
import MySQLdb
import socket
import getpass
import moa.job
import moa.utils
import moa.logger as l
from datetime import datetime
from moa.sysConf import sysConf

# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
# 
# This file is part of Moa - http://github.com/mfiers/Moa
# 
# Licensed under the GPL license (see 'COPYING')
# 
"""
**remoteLogger** - Remotely log Moa activity
--------------------------------------------

requires the standard moa logger to be active
"""




SQL = """
INSERT INTO log (status, start, stop, level, command, full_command, wd, server, template, user, title)
VALUES (%(status)s, %(start)s, %(stop)s, %(level)s, 
        %(command)s, %(full_command)s, %(wd)s, %(server)s,
        %(template)s, %(user)s, %(title)s
        )
"""

def hook_logMessage():
    """
    Restore the log message -  this time in a remote mysql database
    """

    db=MySQLdb.connect(host = sysConf.plugins.remoteLogger.host, 