This repository has been archived by the owner on May 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathLog.py
55 lines (41 loc) · 1.63 KB
/
Log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#-------------------------------------------------------------------------------
# Name: CexControl
# Purpose: Automatically add mined coins on Cex.IO to GHS pool
#
# Author: Eloque
#
# Created: 19-11-2013
# Copyright: (c) Eloque 2013
# Licence: Free to use, copy and distribute as long as I'm credited
# Provided as is, use at your own risk and for your own benefit
# Donate BTC: 17w7oe38d8Rm3pHYLwNZLn8TFSBVEaogJA
#-------------------------------------------------------------------------------
## Preparare Python 3
from __future__ import print_function
from Tkinter import *
import time
from time import strftime
## This file is meant only for logging purposes, to have a central place to change logging into print or or other statements
class Logger:
## Start the Logger object, consider it to be standard to StdOut
def __init__(self):
self.PrintToStdOut = True
self.ToFile = True
self.LogText = ""
self.LogFile = open('CexControl.log', 'a')
def Output( self, Message ):
if self.PrintToStdOut == True:
## Just print it
print ( Message )
else:
timestring = strftime("%Y-%m-%d %H:%M:%S", time.gmtime() )
LogLine = str( timestring + " " + Message + "\n" )
self.LogText.insert(END, LogLine)
self.LogText.see(END)
if self.ToFile == True:
self.LogFile.write( str(int(time.time() ) ) )
self.LogFile.write( " " )
self.LogFile.write( str(Message) )
self.LogFile.write( '\n' )
def SetOutput(self, Value):
self.PrintToStdOut = Value