Re: logging in emacs
Jean Louis <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Organization | GNU Support |
| Message-ID | <[email protected]> |
On 2026-08-31 12:09, Thomas Koch wrote:
> I was wondering what the right way would be to write log messages in
> Emacs, considering also that I wanted to avoid composing messages if
> logging were turned off.
PostgreSQL logging is how I do it. Then you could overwrite those
functions you wish to log, or add some other functions to them to log it
in the database.
Table "public.logtypes"
┌───────────────────────┬──────────────────────────┬───────────┬──────────┬───────────────────────────────────────────────┬──────────┬─────────────┬──────────────┬───────────────┐
│ Column │ Type │ Collation │
Nullable │ Default │ Storage │
Compression │ Stats target │ Description │
├───────────────────────┼──────────────────────────┼───────────┼──────────┼───────────────────────────────────────────────┼──────────┼─────────────┼──────────────┼───────────────┤
│ logtypes_id │ integer │ │ not
null │ nextval('logtypes_logtypes_id_seq'::regclass) │ plain │
│ │ ID │
│ logtypes_datecreated │ timestamp with time zone │ │ not
null │ CURRENT_TIMESTAMP │ plain │
│ │ Date created │
│ logtypes_datemodified │ timestamp with time zone │ │
│ │ plain │
│ │ Date modified │
│ logtypes_usercreated │ text │ │ not
null │ CURRENT_USER │ extended │
│ │ User created │
│ logtypes_usermodified │ text │ │ not
null │ CURRENT_USER │ extended │
│ │ User modified │
│ logtypes_name │ text │ │ not
null │ │ extended │
│ │ Name │
│ logtypes_description │ text │ │
│ │ extended │
│ │ Description │
│ logtypes_uuid │ uuid │ │ not
null │ gen_random_uuid() │ plain │
│ │ UUID │
└───────────────────────┴──────────────────────────┴───────────┴──────────┴───────────────────────────────────────────────┴──────────┴─────────────┴──────────────┴───────────────┘
Indexes:
"logtypes_pkey" PRIMARY KEY, btree (logtypes_id)
"logtypes_index" UNIQUE, btree (logtypes_name)
"logtypes_logtypes_uuid_key" UNIQUE CONSTRAINT, btree
(logtypes_uuid)
Referenced by:
TABLE "log" CONSTRAINT "generallog_generallog_logtypes_fkey" FOREIGN
KEY (log_logtypes) REFERENCES logtypes(logtypes_id)
Triggers:
insert_username_logtypes BEFORE INSERT OR UPDATE ON logtypes FOR
EACH ROW EXECUTE FUNCTION insert_username('logtypes_usermodified')
logtypes_moddatetime BEFORE UPDATE ON logtypes FOR EACH ROW EXECUTE
FUNCTION moddatetime('logtypes_datemodified')
Access method: heap
Table "public.log"
┌──────────────────┬──────────────────────────┬───────────┬──────────┬───────────────────────────────────────────────────┬──────────┬─────────────┬──────────────┬────────────────┐
│ Column │ Type │ Collation │ Nullable │
Default │ Storage │ Compression
│ Stats target │ Description │
├──────────────────┼──────────────────────────┼───────────┼──────────┼───────────────────────────────────────────────────┼──────────┼─────────────┼──────────────┼────────────────┤
│ log_id │ integer │ │ not null │
nextval('generallog_generallog_id_seq'::regclass) │ plain │
│ │ ID │
│ log_datecreated │ timestamp with time zone │ │ not null │
now() │ plain │
│ │ Date created │
│ log_datemodified │ timestamp with time zone │ │ │
│ plain │
│ │ Date modified │
│ log_usercreated │ text │ │ not null │
"current_user"() │ extended │
│ │ User created │
│ log_usermodified │ text │ │ not null │
"current_user"() │ extended │
│ │ User modified │
│ log_peoplelist │ integer │ │ │
│ plain │
│ │ List of people │
│ log_people │ integer │ │ │
│ plain │
│ │ Contact │
│ log_businesses │ integer │ │ │
│ plain │
│ │ Business │
│ log_assignedto │ integer │ │ │
│ plain │
│ │ Assigned to │
│ log_date │ timestamp with time zone │ │ │
now() │ plain │
│ │ Timestamp │
│ log_name │ text │ │ not null │
│ extended │
│ │ Title │
│ log_description │ text │ │ │
│ extended │
│ │ Description │
│ log_publish │ boolean │ │ │
false │ plain │
│ │ Publish │
│ log_hyobjects │ integer │ │ │
│ plain │
│ │ Hyperdocument │
│ log_key │ text │ │ │
│ extended │
│ │ Key │
│ log_logtypes │ integer │ │ not null │ 1
│ plain │
│ │ Log type │
│ log_uuid │ uuid │ │ not null │
gen_random_uuid() │ plain │
│ │ UUID │
│ log_rank │ integer │ │ not null │ 0
│ plain │
│ │ Rank │
│ log_languages │ integer │ │ not null │ 1
│ plain │
│ │ Language │
│ log_note │ text │ │ │
│ extended │
│ │ Note │
└──────────────────┴──────────────────────────┴───────────┴──────────┴───────────────────────────────────────────────────┴──────────┴─────────────┴──────────────┴────────────────┘
Indexes:
"generallog_pkey" PRIMARY KEY, btree (log_id)
"log_log_uuid_key" UNIQUE CONSTRAINT, btree (log_uuid)
Foreign-key constraints:
"generallog_generallog_assignedto_fkey" FOREIGN KEY (log_assignedto)
REFERENCES people(people_id)
"generallog_generallog_contacts_fkey" FOREIGN KEY (log_people)
REFERENCES people(people_id)
"generallog_generallog_hlinks_fkey" FOREIGN KEY (log_hyobjects)
REFERENCES hyobjects(hyobjects_id)
"generallog_generallog_logtypes_fkey" FOREIGN KEY (log_logtypes)
REFERENCES logtypes(logtypes_id)
"log_log_businesses_fkey" FOREIGN KEY (log_businesses) REFERENCES
people(people_id)
"log_log_langugages_fkey" FOREIGN KEY (log_languages) REFERENCES
languages(languages_id)
"log_log_peoplelist_fkey" FOREIGN KEY (log_peoplelist) REFERENCES
people(people_id)
Triggers:
insert_username_log BEFORE INSERT OR UPDATE ON log FOR EACH ROW
EXECUTE FUNCTION insert_username('log_usermodified')
log_moddatetime BEFORE UPDATE ON log FOR EACH ROW EXECUTE FUNCTION
moddatetime('log_datemodified')
Access method: heap
> These are log functions I found in my Emacs:
>
> tramp-message
> tramp-debug-message
> gnus-message
> gmm-message
> yas--message
>
> WoMan-log
> WoMan-log-1
> comp-log
> dired-log
> server-log
> elfeed-log
> flymake-log
>
> url-debug
> sh-debug
> envrc--debug
> jsonrpc--debug
> websocket-debug
> transient--debug
> with-editor-debug
--
Jean Louis