|
1 /* |
|
2 * CDDL HEADER START |
|
3 * |
|
4 * The contents of this file are subject to the terms of the |
|
5 * Common Development and Distribution License (the "License"). |
|
6 * You may not use this file except in compliance with the License. |
|
7 * |
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 * or http://www.opensolaris.org/os/licensing. |
|
10 * See the License for the specific language governing permissions |
|
11 * and limitations under the License. |
|
12 * |
|
13 * When distributing Covered Code, include this CDDL HEADER in each |
|
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 * If applicable, add the following below this CDDL HEADER, with the |
|
16 * fields enclosed by brackets "[]" replaced with your own identifying |
|
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 * |
|
19 * CDDL HEADER END |
|
20 */ |
|
21 |
|
22 /* |
|
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
|
24 * Use is subject to license terms. |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef _FSEXAM_LOG_H |
|
29 #define _FSEXAM_LOG_H |
|
30 |
|
31 /* |
|
32 * What is need log and what is not. |
|
33 * |
|
34 * The problem is that when we want to write log/mes info to the |
|
35 * terminal, we need the fullpath, while the subcoponent of fullpath |
|
36 * may contain NON-UTF8 characters. |
|
37 * |
|
38 * We can always met with such problem if we have no rights to |
|
39 * modify filename on the disk, but we can always reduce this kind |
|
40 * of problem as far as possible. |
|
41 * |
|
42 * So we defer the error msg during constructing tree and handle them |
|
43 * during convertsion to ensure the path name conatin no non-utf8 name |
|
44 * as far as possible. |
|
45 * |
|
46 * - File doesn't exist |
|
47 * |
|
48 * - File Type Not Supported |
|
49 * |
|
50 * - No History Item: |
|
51 * Display in log file when there is no history info. |
|
52 * |
|
53 * ----------------------------------------------------- |
|
54 * - Symlink target doesn't exist: |
|
55 * the target file does't exist: get_abs_path_for_symlink_target == NULL |
|
56 * log when traverse tree and after we convert symlink's filename |
|
57 * Restore: |
|
58 * |
|
59 * - UTF-8 already: |
|
60 * Restore: Don't display such kind of error info, cause it is proper |
|
61 * behavior |
|
62 * |
|
63 * - Remote file |
|
64 * |
|
65 * - Hidden file |
|
66 * |
|
67 */ |
|
68 |
|
69 typedef struct _Log_info Log_info; |
|
70 struct _Log_info { |
|
71 FILE *fp; |
|
72 }; |
|
73 |
|
74 #define LOG_INFO "(II)" |
|
75 #define LOG_WARNING "(WW)" |
|
76 #define LOG_ERROR "(EE)" |
|
77 |
|
78 Log_info * fsexam_log_open (const gchar *logfile); |
|
79 gboolean fsexam_log_puts (Log_info *info, |
|
80 const gchar *filename, |
|
81 const gchar *msg); |
|
82 gboolean fsexam_log_puts_folder_and_name (Log_info *info, |
|
83 const gchar *dirname, |
|
84 const gchar *filename, |
|
85 const gchar *msg); |
|
86 |
|
87 void fsexam_log_flush (Log_info *info); |
|
88 void fsexam_log_close (Log_info *info); |
|
89 |
|
90 #endif //_FSEXAM_LOG_H |