mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-07 22:21:32 +00:00
swupd prints some messages to stdout and others to stderr, this makes the code somewhat confusing and also it creates a mess regarding which messages go where. Messages are usually printed using fprintf() and printf(). This commit replaces all calls to printf and fprintf with one of the functions that are part of the logger. This will bring many advantages to the code: - readability, it is straightforward to identify where a message needs to go based on the name of the logger functions. - consistency, the output will go to either stderr or stdout depending on the type of message being printed. - the format of the messages will also be consistent, so for example, if the message is an error the message will automatically include the "Error: " label in the beginning of the message, this way we avoid having things like "ERROR:", "error - ", etc... Closes #864 Closes #294 Closes #489 Closes #433 Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
/*
|
|
* Software Updater - client side
|
|
*
|
|
* Copyright © 2012-2016 Intel Corporation.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, version 2 or later of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Authors:
|
|
* Arjan van de Ven <arjan@linux.intel.com>
|
|
*
|
|
*/
|
|
|
|
#define _GNU_SOURCE
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#include "swupd.h"
|
|
|
|
int swupd_stats[8];
|
|
|
|
void print_statistics(int version1, int version2)
|
|
{
|
|
info("\n");
|
|
info("Statistics for going from version %i to version %i:\n\n", version1, version2);
|
|
info(" changed bundles : %i\n", swupd_stats[5]);
|
|
info(" new bundles : %i\n", swupd_stats[3]);
|
|
info(" deleted bundles : %i\n\n", swupd_stats[4]);
|
|
info(" changed files : %i\n", swupd_stats[2]);
|
|
info(" new files : %i\n", swupd_stats[0]);
|
|
info(" deleted files : %i\n", swupd_stats[1]);
|
|
info("\n");
|
|
}
|