Skip to content

Instantly share code, notes, and snippets.

@IuryAlves
Created June 23, 2013 02:06
Show Gist options
  • Save IuryAlves/5843447 to your computer and use it in GitHub Desktop.
Save IuryAlves/5843447 to your computer and use it in GitHub Desktop.
# 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