Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, March 29, 2024

File: [Platon] / tucniak / util / log.c (download)

Revision 1.1.1.1 (vendor branch), Fri Nov 11 16:08:27 2005 UTC (18 years, 4 months ago) by koli


Changes since 1.1: +0 -0 lines

Initial import

// Copyright (c) 2003 Juraj Kolesár (koli) <koli@koli.sk>               
#include <curses.h>
#include <time.h>
#include "log.h"

FILE *log_file;

void log_init() {
    log_file = fopen("tucniak.log", "a");
}

void log(const char *fmt, ...) {
    va_list args;
    time_t ct;
    char *tmstr;
    char buffer[1024];
    va_start(args, fmt);vsnprintf(buffer, 1023, fmt, args);va_end(args);
    ct = time(0);
    tmstr = asctime(localtime(&ct));
    *(tmstr + strlen(tmstr) - 1) = '\0';
    fprintf(log_file, "%-15.15s :: %s\n", tmstr + 4, buffer);
    fflush(log_file);
}

void log_close() {
    fclose(log_file);
}

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top