Skip to content

Instantly share code, notes, and snippets.

@IuryAlves

IuryAlves/log.py

Created Jun 23, 2013
Embed
What would you like to do?
# 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