# Path: pyGBot/log.py
# def addScreenHandler(logobj, format):
# def addLogFileHandler(logobj, filename, format):
# 
# Path: pyGBot/core.py
# CHANNEL_PREFIXES = '&#!+'
# 
# Path: pyGBot/BasePlugin.py
# class BasePlugin:
#     def __init__(self, bot, options):
#         self.bot = bot
# 
#     def activate(self, channel=None):
#         """
#         Called when the plugin is activated.
#         """
#         return True
# 
#     def deactivate(self, channel=None):
#         """
#         Called when the plugin is deactivated.
#         """
#         return True
# 
#     # Event handlers for other users
#     def user_join(self, channel, username):
#         pass
# 
#     def user_part(self, channel, username):
#         pass
# 
#     def user_kicked(self, channel, username, kicker, message=""):
#         pass
# 
#     def user_quit(self, username, reason=""):
#         pass
# 
#     def user_nickchange(self, username, newname):
#         pass
# 
#     # Event handlers for this bot
#     def bot_connect(self):
#         pass
# 
#     def bot_join(self, channel):
#         pass
# 
#     def bot_part(self, channel):
#         pass
# 
#     def bot_kicked(self, channel, kicker="", reason=""):
#         pass
# 
#     def bot_disconnect(self):
#         pass
# 
# 
#     # Event handlers for incoming messages
#     def msg_channel(self, channel, user, message):
#         pass
# 
#     def msg_action(self, channel, user, message):
#         pass
# 
#     def msg_private(self, user, message):
#         pass
# 
#     def msg_notice(self, user, message):
#         pass
# 
#     # Event handlers for channel information replies
#     def channel_names(self, channel, nameslist):
#         pass
# 
#     def channel_topic(self, channel, user, topic):
#         pass
# 
#     # Other system event handlers
#     def timer_tick(self):
#         pass


from pyGBot import log
from pyGBot.core import CHANNEL_PREFIXES
from pyGBot.BasePlugin import BasePlugin
from twisted.internet import reactor
import logging
##
##    You should have received a copy of the GNU General Public License
##    along with this program.  If not, see <http://www.gnu.org/licenses/>.
##


class Log2channel(BasePlugin):
    """ This plugin allows pyGBot to log to a channel. This can be useful, for
    example, to allow users or ops to monitor changes that users in the main
    channel make to a factoid database. This obeys the loglevel property, but
    will never log debug messages to the channel even at loglevel = debug.

    Configuration options (pyGBot.ini):
    [Plugins.system.Log2channel]
    channel: channel to log to. Do NOT include the # character in front.
    loglevel: 'warning' or 'info', same effect as loglevel in [IRC]. If the
        loglevel option in [IRC] is less verbose than the one here, that one is
        used instead.
    logformat: The log format string. See the fmt arg of the logging.Formatter
        constructor in the Python docs. Default: "%(asctime)s: %(levelname)s
        %(message)s"
    dateformat: The date/time format used for "%(asctime)s" in the logformat.
        Uses the strftime syntax. Default: "%H:%M:%S"
    """

    # default settings
    logformat  = '%(asctime)s: %(levelname)s %(message)s'
    dateformat = '%H:%M:%S'

    def __init__(self, bot, options):

# Path: pyGBot/log.py
# def addScreenHandler(logobj, format):
# def addLogFileHandler(logobj, filename, format):
# 
# Path: pyGBot/core.py
# CHANNEL_PREFIXES = '&#!+'
# 
# Path: pyGBot/BasePlugin.py
# class BasePlugin:
#     def __init__(self, bot, options):
#         self.bot = bot
# 
#     def activate(self, channel=None):
#         """
#         Called when the plugin is activated.
#         """
#         return True
# 
#     def deactivate(self, channel=None):
#         """
#         Called when the plugin is deactivated.
#         """
#         return True
# 
#     # Event handlers for other users
#     def user_join(self, channel, username):
#         pass
# 
#     def user_part(self, channel, username):
#         pass
# 
#     def user_kicked(self, channel, username, kicker, message=""):
#         pass
# 
#     def user_quit(self, username, reason=""):
#         pass
# 
#     def user_nickchange(self, username, newname):
#         pass
# 
#     # Event handlers for this bot
#     def bot_connect(self):
#         pass
# 
#     def bot_join(self, channel):
#         pass
# 
#     def bot_part(self, channel):
#         pass
# 
#     def bot_kicked(self, channel, kicker="", reason=""):
#         pass
# 
#     def bot_disconnect(self):
#         pass
# 
# 
#     # Event handlers for incoming messages
#     def msg_channel(self, channel, user, message):
#         pass
# 
#     def msg_action(self, channel, user, message):
#         pass
# 
#     def msg_private(self, user, message):
#         pass
# 
#     def msg_notice(self, user, message):
#         pass
# 
#     # Event handlers for channel information replies
#     def channel_names(self, channel, nameslist):
#         pass
# 
#     def channel_topic(self, channel, user, topic):
#         pass
# 
#     # Other system event handlers
#     def timer_tick(self):
#         pass


# Path: pyGBot/Plugins/system/Log2channel.py
from pyGBot import log
from pyGBot.core import CHANNEL_PREFIXES
from pyGBot.BasePlugin import BasePlugin
from twisted.internet import reactor
import logging

##
##    You should have received a copy of the GNU General Public License
##    along with this program.  If not, see <http://www.gnu.org/licenses/>.
##


class Log2channel(BasePlugin):
    """ This plugin allows pyGBot to log to a channel. This can be useful, for
    example, to allow users or ops to monitor changes that users in the main
    channel make to a factoid database. This obeys the loglevel property, but
    will never log debug messages to the channel even at loglevel = debug.

    Configuration options (pyGBot.ini):
    [Plugins.system.Log2channel]
    channel: channel to log to. Do NOT include the # character in front.
    loglevel: 'warning' or 'info', same effect as loglevel in [IRC]. If the
        loglevel option in [IRC] is less verbose than the one here, that one is
        used instead.
    logformat: The log format string. See the fmt arg of the logging.Formatter
        constructor in the Python docs. Default: "%(asctime)s: %(levelname)s
        %(message)s"
    dateformat: The date/time format used for "%(asctime)s" in the logformat.
        Uses the strftime syntax. Default: "%H:%M:%S"
    """

    # default settings
    logformat  = '%(asctime)s: %(levelname)s %(message)s'
    dateformat = '%H:%M:%S'

    def __init__(self, bot, options):

        BasePlugin.__init__(self, bot, options)