Created
June 23, 2013 02:06
-
-
Save IuryAlves/5843447 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import time | |
tempo = time.localtime() | |
dia = tempo.tm_mday | |
mes = tempo.tm_mon | |
ano = tempo.tm_year | |
seg = tempo.tm_sec | |
arquivo = open('logs/log.txt','a') | |
def criarLog(): | |
global arquivo,dia,mes,ano,seg | |
arquivo.write('== data do log: ' + str(seg) + ' ' + str(dia) + ' ' + str(mes) + ' ' + str(ano) + '==' ) | |
def atualizarLog(texto=' '): | |
global arquivo,dia,mes,ano,seg | |
novoTempo = time.localtime() | |
novoDia = novoTempo.tm_mday | |
if novoDia == dia: | |
arquivo.write('== data do log: ' + str(seg) + ' ' + str(dia) + ' ' + str(mes) + ' ' + str(ano) + '==' ) | |
arquivo.write(texto) | |
arquivo.seek(1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment