about summary refs log tree commit diff stats
path: root/src/log.c
Commit message (Collapse)AuthorAgeFilesLines
* log: put static functions on topMichael Vetter2022-06-281-55/+52
|
* Split log.c into log.c and chatlog.cMichael Vetter2022-06-281-462/+0
|
* Display log level information in preferencesMichael Vetter2022-06-221-0/+17
|
* Rename _log_string_from_level to _log_abbreviation_string_from_levelMichael Vetter2022-06-221-3/+4
|
* Update copyright yearMichael Vetter2022-05-091-1/+1
|
* Use profanity.001.log instead of profanity.log.001 for rotated logsMichael Vetter2022-04-291-8/+13
| | | | | | | | Rotated log files will now be: `.local/share/profanity/logs/profanity.001.log` We only use logrotation if we use the default log file ending with .log. So Replacing the `.` should be fine. User supplied log files are not rotated.
* Use 3 digits for rotated logfilesMichael Vetter2022-04-291-3/+3
| | | | profanity.log.001 -> 999.
* Use ISO8601 for log filesMichael Vetter2022-04-291-1/+1
|
* Use ISO8601 for chatlogsMichael Vetter2022-04-291-2/+2
| | | | For both 1:1 and groupchat.
* Fix logging (this time for real)Steffen Jaeckel2022-04-011-1/+7
| | | | | | | | | | ... I hope ... We also need to create the path where the logs are stored. Fixup of d82f2f293b056965fc0bed2b24820961885ab90b Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
* fix path where logs are storedSteffen Jaeckel2022-04-011-1/+3
| | | | | | | 43e5f15e66b83ac8f3d57d2ffc7babf57873c51c broke the creation of the path where chatlogs are stored. This is fixed now. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
* refactor logfile-name creationSteffen Jaeckel2022-03-141-66/+10
| | | | Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
* Format code correctlyMichael Vetter2021-10-051-1/+1
|
* Fix log rotationMichael Vetter2021-07-051-1/+1
| | | | | | Fix https://github.com/profanity-im/profanity/issues/1518 See https://github.com/profanity-im/profanity/issues/1518#issuecomment-870581988
* Fix log rotationMichael Vetter2021-06-281-7/+1
| | | | | | | | | | | | | | | | | | | | See https://github.com/profanity-im/profanity/issues/1518 It has a good explanation of what happened: ``` Apparently, the _rotate_log_file function tried to extract user-provided name from currently used mainlogfile and restart logging to the same place after rotation, but currently this is interpreted as a full path instead. As I understand, the log rotation is no longer done with user-provided paths at all so this should be simply skipped altogether now as passing any non-NULL value is interpreted as user-provided. Replacing start with NULL appears to fix it for me. ``` In log_msg() we only rotate the log if not user_provided_log. https://github.com/profanity-im/profanity/pull/1455 changed the behaviour from user defined filename in the log dir to using full path.
* Add config.h in files were it was missingMichael Vetter2021-03-261-0/+2
| | | | Related to https://github.com/profanity-im/profanity/issues/1512
* Only rotate logs if user didn't specify a log fileMichael Vetter2020-12-111-1/+7
|
* Remove log_reinit()Michael Vetter2020-12-111-14/+0
| | | | Not needed anymore.
* Declare counter var inside loopMichael Vetter2020-11-091-4/+2
| | | | We require c99/gnu99 anyways.
* Apply coding styleMichael Vetter2020-07-071-147/+146
|
* Revert "Apply coding style"Michael Vetter2020-07-071-143/+149
| | | | | | This reverts commit 9b55f2dec0ea27a9ce4856e303425e12f866cea2. Sorting the includes creates some problems.
* Apply coding styleMichael Vetter2020-07-071-149/+143
| | | | Regards https://github.com/profanity-im/profanity/issues/1396
* Rework loggingStefan Kropp2020-07-031-2/+2
| | | | | | Changed default logging from INFO to WARN. Issue: #1353
* log.c: Format codeMichael Vetter2020-07-021-7/+9
|
* log.c: Use gchar* instead of GString for mainlogfileMichael Vetter2020-07-021-10/+9
|
* Remove prefs_free_string()Michael Vetter2020-07-021-8/+8
| | | | | It just does a free. Related to b580b9ef119045f142fa4baa9689a1c5ce8864ef
* Define POSIX macro to have strdupMichael Vetter2020-06-121-2/+2
| | | | | | | | | | | | | | https://github.com/profanity-im/profanity/commit/98c38dc6d6d29333c63f80327774f094610d8602 sets C99 as standard. strdup() is not part of C99. For now set `-D_POSIX_C_SOURCE=200809L` macro to have strdup() in C99. Using `gnu99` instead would be another option. We should take more care to use glib functions whenever possible. Regards https://github.com/profanity-im/profanity/issues/1357
* Add and use connection_get_barejid()Michael Vetter2020-05-251-63/+56
| | | | Instead of connection_get_fulljid() and then creating a Jid from it.
* log: don't log dtMichael Vetter2020-04-201-3/+3
| | | | Use another name.
* log: Dont shadow logpMichael Vetter2020-04-201-16/+16
| | | | Let's use another name.
* Add to_jid field to ProfMessage structMichael Vetter2020-04-111-14/+14
| | | | | Is usefult in many cases if we want cleaner code. Hope this edit didn't break anything though ;-)
* Add type field to ProfMessageMichael Vetter2020-04-061-7/+7
| | | | The mucuser boolean is not now needed anymore.
* Remove chat_log_get_previous()Michael Vetter2020-04-061-48/+0
| | | | | | | | | | | | We now dont get the log files from the text files via chat_log_get_previous() anymore. We use the sql backend via log_database_get_previous_chat(). So far it just has the same behaviour like chat_log_get_previous(), except that in _chatwin_history() we don't pass the sender to win_print_history() which should be fixed in a commit soon. And log_database_get_previous_chat() can later easily be expanded to fix https://github.com/profanity-im/profanity/issues/205.
* Rename PROF_MSG_ENC_PLAIN to PROF_MSG_ENC_NONEMichael Vetter2020-04-061-1/+1
|
* Fix errors in log.cMichael Vetter2020-02-221-1/+2
|
* get_log_file_location () should return const char*Michael Vetter2020-02-211-1/+1
| | | | Make clear that result should never be freed.
* Allow setting custom log file via -f FILENAMEMichael Vetter2020-02-211-10/+28
| | | | | `profanity -f TEST` will use `~/.local/share/profanity/logs/TEST.log` as the log file.
* Add vim modelineMichael Vetter2019-11-131-0/+1
|
* Actually log MUC PM messagesMichael Vetter2019-10-281-11/+11
| | | | | | | | | | If I'm not mistaken MUC PMs have not been logged at all if there was no other client sending carbons. This should add MUC PM logging functionality. We still need to make sure carbons log to the same file. Regards https://github.com/profanity-im/profanity/issues/1214
* Properly display chatwin historyMichael Vetter2019-10-211-1/+0
| | | | | | | | | | | | | | | | | | | | So far if one had enabled `/history` and did `/msg somenick` the history was loaded from file and displayed like this: ``` 04-04-17 15:23 - 3/4/2017: 01-01-00 10:30 - me: .... 01-01-00 10:31 - somebody: .... 01-01-00 10:32 - somebody: .... ``` So the first line contained the actual date. But the date used in each line was always 01-01-2000. This date was for some reason hardcoded. This commit now actually uses that date to build the proper GDateTime instead of just printing it. Fix https://github.com/profanity-im/profanity/issues/922
* Improve MUC 1:1 loggingMichael Vetter2019-10-071-25/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we get a private message from a user in a MUC profanity shows this like: `profanity@roomsASDF.dismail.de/Martin: Hi` This was so far logged at: `~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de/2019_09_04.log` as: ``` 10:48:13 - profanity@rooms.dismail.de: Hi ``` So the nickname was not saved anywhere. This is due to us not knowing whether we got a regular message from user@server.org/resource or a MUC PM from room@server.org/user. We now check for `<x xmlns='http://jabber.org/protocol/muc#user' />` and add the resourcepart to the logging if we get it. The file will be created at `~/.local/share/profanity/chatlogs/my-account-at-server/profanity_at_rooms.dismail.de_nick` and look like: ``` 23:59:43 - nick: Hi ``` Fix https://github.com/profanity-im/profanity/issues/1184
* log: set nonblocking mode for stderrDmitry Podgorny2019-09-131-6/+16
| | | | | | | Glib can print error messages to stderr and blocking write freezes Profanity if the buffer is full. Move stderr to nonblocking mode in hope that glib will skip printing on EWOULDBLOCK error. In this case we lose some error messages, but Profanity continues working.
* Rename prof_message_t into ProfMessagePaul Fariello2019-06-201-4/+4
|
* Add prof_message_t to wrap all message attributesPaul Fariello2019-06-201-12/+12
| | | | | | | Probably missing copy of body to plain in carbon and privmessage. Only covers the incoming message path because goal is OMEMO decryption of untrusted message. Cover some of the log functions but not all.
* Add myself to copyrightMichael Vetter2019-06-171-0/+1
| | | | Like discussed with James.
* Iterate logfiles until 100 are reachedMichael Vetter2019-06-071-6/+9
| | | | Fix https://github.com/profanity-im/profanity/issues/519
* Log and print outgoing encrypted messagePaul Fariello2019-04-101-1/+63
|
* Add OMEMO message encryption and decryptionPaul Fariello2019-04-101-0/+34
|
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
|
* Fix gcc8 error about strncpyMichael Vetter2018-07-061-1/+1
| | | | | | | | | | | | | | | | | | With gcc8 we get the following error when stringop-truncation is on: ``` In function ‘_rotate_log_file’, inlined from ‘log_msg.part.2’ at src/log.c:201:17: src/log.c:231:5: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy(log_file_new, log_file, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/log.c: In function ‘log_msg.part.2’: src/log.c:228:18: note: length computed here size_t len = strlen(log_file); ^~~~~~~~~~~~~~~~ ``` Using memcpy instead of strncpy.