{"id":17988064,"url":"https://github.com/lujun9972/elog","last_synced_at":"2026-01-18T18:01:51.427Z","repository":{"id":91558520,"uuid":"45612735","full_name":"lujun9972/elog","owner":"lujun9972","description":"a log library used in elisp","archived":false,"fork":false,"pushed_at":"2022-12-07T06:43:31.000Z","size":24,"stargazers_count":6,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T15:12:21.897Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lujun9972.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-05T13:25:45.000Z","updated_at":"2022-12-07T06:43:33.000Z","dependencies_parsed_at":"2023-03-02T10:45:19.201Z","dependency_job_id":null,"html_url":"https://github.com/lujun9972/elog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujun9972%2Felog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujun9972%2Felog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujun9972%2Felog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujun9972%2Felog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lujun9972","download_url":"https://codeload.github.com/lujun9972/elog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247114399,"owners_count":20885925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T19:10:32.048Z","updated_at":"2026-01-18T18:01:51.419Z","avatar_url":"https://github.com/lujun9972.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE: elog\n#+AUTHOR: DarkSun\n#+CATEGORY: elog\n#+DATE: [2015-11-06 五 07:03]\n#+OPTIONS: ^:{}\n\n* What is elog\nelog is a simple logging library for elisp. It is extended from [[https://github.com/sigma/logito][logito]]\n\n* How to use elog\n1. require the file\n   \n   #+BEGIN_SRC emacs-lisp\n     (require 'elog)\n   #+END_SRC\n\n2. use `elog-open-log' macro to generate your own logging function.\n   \n   #+BEGIN_SRC emacs-lisp\n     (elog-open-log TYPE IDENT \u0026rest init-args)\n   #+END_SRC\n\n   This macro generate two functions: the `elog-IDENT-log' for logging job and the `elog-IDENT-close-log' for cleanning job.\n\n   `TYPE' specify which kind of elog-object is used. Now, elog support four types of elog-object:\n\n   + message :: use `message' function to do the logging job.\n\n   + buffer :: log item will be recoreded in a specify buffer.\n\n   + file :: log item will be recoreded in a specify file.\n\n   + syslog :: log item will be send to a syslogd server.\n             \n   `init-args' is used to initialize the elog-object.\n   \n   + the base elog-object\n     \n     - :serverity :: specify the logging level. The default value is `elog-info'\n\n     - :fmt :: specify the logging format string. There are some %-sequences has a special meaning in it.\n             %I means the `IDENT' argument\n             %T means current time \n             %L means level\n             %M means message\n\n   + the elog-buffer-object  \n\n     - :buffer :: It specify which buffer is used to record the logging item.\n\n   + the elog-file-object\n\n     - :file :: It specify which file is used to record the logging item.\n\n   + the elog-syslog-object\n\n     - :host :: It specify the syslogd server host\n\n     - :port :: It specify the syslogd service port\n\n     - :facility :: It specify the facility\n\n3. use `IDENT-log' function to do the logging job.\n   \n   (IDENT-log LEVEL FORMAT-STRING \u0026rest OBJECTS)\n\n4. use `IDENT-close-log' function to do the cleanning job if you wish.\n\n   (IDENT-close-log)\n\n5. use `IDENT-set-log-serverity' function to change the logging serverity\n   \n   (IDENT-set-log-serverity NEW-SERVERITY)\n\n6. use `IDENT-log-serverity' function to get the current logging serverity\n   \n   (IDENT-log-serverity)\n\n** Examples\n\n*** use message function to display log\n#+BEGIN_SRC emacs-lisp\n\n  (elog-open-log message \"MSG\" :prelog-functions (list (lambda (log)\n                                                         (message \"start to log at %s\" (current-time-string))))\n                               :postlog-functions (list (lambda (log)\n                                                         (message \"log done at %s\" (current-time-string)))))\n\n  (MSG-log elog-error \"%s-%d\" \"hello\" 123)\n#+END_SRC\n\n*** record log to a buffer\n#+BEGIN_SRC emacs-lisp\n  (elog-open-log buffer \"BUF\" :buffer \"elog\")\n\n  (BUF-log elog-error \"%s-%d\" \"hello\" 123)\n\n  (BUF-close-log)\n#+END_SRC\n\n*** record log to a file\n#+BEGIN_SRC emacs-lisp\n  (defun elog-get-log-name ()\n    (format \"/tmp/%s/elog.log\" (format-time-string \"%Y%m/%d\")))\n  (elog-open-log file \"FILE\" :file 'elog-get-log-name\n                             :modes 700\n                             :max-size 10\n                             :old-dir \"/tmp/elog/\"\n                             :compress-command \"gzip %L\")\n  (FILE-log-serverity)\n  (FILE-set-log-serverity elog-emerg)\n\n   (FILE-log elog-error \"%s-%d\" \"hello\" 123)\n#+END_SRC\n\n*** record log to syslog\n#+BEGIN_SRC emacs-lisp\n  (elog-open-log syslog \"SYSLOG\" :host \"10.8.208.121\" :port 514 :facility elog-local7)\n\n  (SYSLOG-log elog-error \"%s-%d\" \"hello\" 123)\n\n  (SYSLOG-close-log)\n#+END_SRC\n* How to extend elog\nElog is extensible. You just need to define a new subclass of elog-object  three method:\n\n+ elog-should-log-p :: this function is used to check if the log item should be recorded\n\n+ elog-insert-log :: this function is used to do the actual logging job\n\n+ elog-close-log :: this function is used to do the cleanning job.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flujun9972%2Felog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flujun9972%2Felog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flujun9972%2Felog/lists"}