corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject [2/2] incubator-corinthia git commit: Logging feature update
Date Sat, 22 Aug 2015 23:54:58 GMT
Logging feature update

Add dedicated general logging macros, set a symlink 'current.log', and
allow local custom log macros with dedicated names for the log file.
Remove the tar file and use snprintf instead strncat and strdup.

Todo:  plug in user defined output function pointer mechanism.

  * Makefile:

    Temporary way to compile the logger.  Usage:
      $ make; ./logMaker

  * log_maker.c:

    Code for the logging functions.

    (#define): Add _GNU_SOURCE.

    (#include): Add "log_maker.h".
                Add <assert.h>.
                Add <error.h>.
                Add <libgen.h>.
                Add <stdarg.h>.
                Add <stdio.h>.
                Add <stdlib.h>.
                Add <string.h>.
                Add <time.h>.
                Add <unistd.h>.
                Add <errno.h>.
                Add <dirent.h>.
                Add <sys/types.h>.
                Add <sys/stat.h>.
                Add <fcntl.h>.
      These are probably not all needed.

    (get_time_string): New function.

    (set_log_output_function): New function.  This is a stub.

    (log_init): New function.  Create the logfile name with host, time
      and program name. Set a symlink 'current.log' into
      ~/../incubator/.

    (set_log_dir): New function.  Set the directory in which to write
      the individual logfiles and the location where the symlonk
      should be created.

    (close_log): New function.  Close the file descriptor and inform
      user about the location and name of the generated file.

    (log_msg_prefix): New function.  Create the prefix containing the
      name of the log level, the file, line number and function name.

    (log_msg): New function. Write the log prefix and log message to
      file.

  * log_maker.h:

    Header file for general inclusion so log_maker.c can be used.

    (#ifndef): Add LOG_MAKER_H.
      Header guard.  Somehow #pragma once does not work for me.

    (#if): Add _MSC_VER.  Picked this up in the docs, apparently MSC
      uses _sprintf instead.

    (#define):  Add LOG_ERR.
                Add LOG_WARNING.
                Add LOG_NOTICE.
                Add LOG_INFO.
                Add LOG_DEBUG.
        These are all strings for now.  I can change it back to numbers, but
        currently those strings are used to print out the log message titles.

    Global variables:

    (char): Add log_filename[filename_len].

    (int): Add log_file_fd.  File descriptor for log file.

    (static int log_level_initialised): Guard to prevent log_init from
      being called twise.

    (char): Add logging_dir[filename_len].

    (char): Add log_symlink[filename_len].

    (LOG_THIS): New function.  Basic macro, called by every custom macro.

    Basic log macros for general usage:

    (LOG_ERROR_MSG): New function.

    (LOG_WARNING_MSG): New function.

    (LOG_NOTICE_MSG): New function.

    (LOG_INFO_MSG): New function.

    (LOG_DEBUG_MSG): New function.

    Prototypes for logmaker.c:

    (set_log_output_function): New function.

    (log_init): New function.

    (set_log_dir): New function.

    (set_log_level): New function.

    (close_log): New function.

    (log_msg_prefix): New function.

  * useLogmaker.c:

    Test code for log_maker.c

    (#include): Add "log_maker.h".
                Add <stdio.h>.
                Add <unistd.h>.

    (LOG_USE_LOGMAKER_MSG): New function.  This is a custom log macro
      that only works for the local file.

    (function_one): New function.  Test every general macro.

    (function_two): New function.  Test base macro 'LOG_THIS' and test
      locally defined macro.

    (main): New function.  Run tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/e1dc6c9a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/e1dc6c9a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/e1dc6c9a

Branch: refs/heads/master
Commit: e1dc6c9ab57107d1bdacc144d1ecf1f0edb2d6fd
Parents: a507ec5 2daa000
Author: Gabriela Gibson <gbg@apache.org>
Authored: Sun Aug 23 00:54:47 2015 +0100
Committer: Gabriela Gibson <gbg@apache.org>
Committed: Sun Aug 23 00:54:47 2015 +0100

----------------------------------------------------------------------
 .../src/Toolkit_Layer_1/qt/Editor.cpp           |   16 +-
 .../src/Toolkit_Layer_1/qt/MainWindow.cpp       |   88 +-
 .../src/Toolkit_Layer_1/qt/Toolbar.cpp          |   12 +-
 .../src/Toolkit_Layer_1/qt/moc_qt_classes.cpp   |  185 +-
 .../src/Toolkit_Layer_1/qt/qt_classes.hpp       |  113 +-
 .../src/Toolkit_Layer_1/qt/qt_toolkit.cpp       |   26 +-
 experiments/objcFramework/DocFormats.h          |   79 +
 experiments/objcFramework/EDDocumentSetup.h     |   32 +
 experiments/objcFramework/EDDocumentSetup.m     |  225 +++
 experiments/objcFramework/EDEditor.h            |  112 ++
 experiments/objcFramework/EDEditor.m            |  413 ++++
 experiments/objcFramework/EDFileFormat.h        |   65 +
 experiments/objcFramework/EDFileFormat.m        |  968 ++++++++++
 experiments/objcFramework/EDFindReplace.h       |   48 +
 experiments/objcFramework/EDFindReplace.m       |   82 +
 experiments/objcFramework/EDGeometry.h          |   80 +
 experiments/objcFramework/EDGeometry.m          |  119 ++
 experiments/objcFramework/EDHTMLTidy.h          |   42 +
 experiments/objcFramework/EDHTMLTidy.m          |   58 +
 experiments/objcFramework/EDJSInterface.h       |  365 ++++
 experiments/objcFramework/EDJSInterface.m       | 1775 ++++++++++++++++++
 experiments/objcFramework/EDObservation.h       |   30 +
 experiments/objcFramework/EDObservation.m       |   56 +
 experiments/objcFramework/EDOutline.h           |  132 ++
 experiments/objcFramework/EDOutline.m           |  270 +++
 experiments/objcFramework/EDSaveOperation.h     |   44 +
 experiments/objcFramework/EDSaveOperation.m     |  166 ++
 experiments/objcFramework/EDScan.h              |   64 +
 experiments/objcFramework/EDScan.m              |  138 ++
 experiments/objcFramework/EDScanResults.h       |   73 +
 experiments/objcFramework/EDScanResults.m       |  109 ++
 .../objcFramework/EDSelectionFormatting.h       |   55 +
 .../objcFramework/EDSelectionFormatting.m       |   73 +
 experiments/objcFramework/EDStyle.h             |   59 +
 experiments/objcFramework/EDStyle.m             |  150 ++
 experiments/objcFramework/EDTiming.h            |   80 +
 experiments/objcFramework/EDTiming.m            |  271 +++
 experiments/objcFramework/EDUtil.h              |   41 +
 experiments/objcFramework/EDUtil.m              |  325 ++++
 experiments/objcFramework/EDWordCount.h         |   42 +
 experiments/objcFramework/EDWordCount.m         |   57 +
 experiments/objcFramework/Editor.h              |   40 +
 tree_github_repository.html                     |    4 +-
 tree_local_directory.html                       |    4 +-
 44 files changed, 6877 insertions(+), 309 deletions(-)
----------------------------------------------------------------------



Mime
View raw message