utils/slog.c
void slog(int level, int flag, const char *msg, ...) 
{
    /* Used variables */
    SystemDate mdate;
    char string[MAXMSG];
    char prints[MAXMSG];
    char *output;

    /* Initialise system date */
    get_system_date(&mdate);

    /* Read args */
    va_list args;
    va_start(args, msg);
    vsprintf(string, msg, args);
    va_end(args);

    /* Check logging levels */
    if(level <= slg.level) 
    {
        /* Handle flags */
        switch(flag) {
            case 1:
                sprintf(prints, "[მიმდინარე]  %s", string);
                break;
            case 2:
                sprintf(prints, "[%s] %s", strclr(1, "ინფორმაცია"), string);
                break;
            case 3:
                sprintf(prints, "[%s] %s", strclr(3, "გაფრთხილება"), string);
                break;
            case 4:
                sprintf(prints, "[%s] %s", strclr(4, "დებაგი"), string);
                break;
            case 5:
                sprintf(prints, "[%s] %s", strclr(2, "შეცდომა"), string);
                break;
            case 6:
                sprintf(prints, "[%s] %s", strclr(2, "ფატალური"), string);
                break;
            case 7:
                sprintf(prints, "%s", string);
                break;
            default:
                break;
        }

        /* Print output */
        printf("%s", ret_slog("%s\n", prints));

        /* Save log in file */
        if (slg.to_file) 
        {
            output = ret_slog("%s\n", string);
            log_to_file(output, slg.fname, &mdate);
        }
    }
}
/*
 * slog - Log exiting process. Function takes arguments and saves 
 * log in file if LOGTOFILE flag is enabled from config. Otherwise 
 * it just prints log without saveing in file. Argument level is 
 * logging level and flag is slog flags defined in slog.h header.
 */
Log exiting process. Function takes arguments and saves
log in file if LOGTOFILE flag is enabled from config. Otherwise
it just prints log without saveing in file. Argument level is
logging level and flag is slog flags defined in slog.h header.
Log exiting process . Function takes arguments and saves log in file if LOGTOFILE flag is enabled from config . Otherwise it just prints log without saveing in file . Argument level is logging level and flag is slog flags defined in slog . h header .
void slog(int level, int flag, const char *msg, ...) 
{
    SystemDate mdate;
    char string[MAXMSG];
    char prints[MAXMSG];
    char *output;
    get_system_date(&mdate);
    va_list args;
    va_start(args, msg);
    vsprintf(string, msg, args);
    va_end(args);
    if(level <= slg.level) 
    {
        switch(flag) {
            case 1:
                sprintf(prints, "[მიმდინარე]  %s", string);
                break;
            case 2:
                sprintf(prints, "[%s] %s", strclr(1, "ინფორმაცია"), string);
                break;
            case 3:
                sprintf(prints, "[%s] %s", strclr(3, "გაფრთხილება"), string);
                break;
            case 4:
                sprintf(prints, "[%s] %s", strclr(4, "დებაგი"), string);
                break;
            case 5:
                sprintf(prints, "[%s] %s", strclr(2, "შეცდომა"), string);
                break;
            case 6:
                sprintf(prints, "[%s] %s", strclr(2, "ფატალური"), string);
                break;
            case 7:
                sprintf(prints, "%s", string);
                break;
            default:
                break;
        }
        printf("%s", ret_slog("%s\n", prints));
        if (slg.to_file) 
        {
            output = ret_slog("%s\n", string);
            log_to_file(output, slg.fname, &mdate);
        }
    }
}
void slog ( int level , int flag , const char * msg , ... ) { SystemDate mdate ; char string [ MAXMSG ] ; char prints [ MAXMSG ] ; char * output ; get_system_date ( & mdate ) ; va_list args ; va_start ( args , msg ) ; vsprintf ( string , msg , args ) ; va_end ( args ) ; if ( level <= slg . level ) { switch ( flag ) { case 1 : sprintf ( prints , " break ; case 2 : sprintf ( prints , " " , strclr ( 1 , " break ; case 3 : sprintf ( prints , " " , strclr ( 3 , " break ; case 4 : sprintf ( prints , " " , strclr ( 4 , " break ; case 5 : sprintf ( prints , " " , strclr ( 2 , " break ; case 6 : sprintf ( prints , " " , strclr ( 2 , " break ; case 7 : sprintf ( prints , " " , string ) ; break ; default : break ; } printf ( " " , ret_slog ( " \n " , prints ) ) ; if ( slg . to_file ) { output = ret_slog ( " \n " , string ) ; log_to_file ( output , slg . fname , & mdate ) ; } } }
slog - Log exiting process.
slog - Log exiting process .
/* Used variables */ /* Initialise system date */ /* Read args */ /* Check logging levels */ /* Handle flags */ /* Print output */ /* Save log in file */