Skip to content

Instantly share code, notes, and snippets.

@IuryAlves
Created June 23, 2013 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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