From 78b6a354dfb269041eae7cefb6833ef70682b756 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Tue, 28 Mar 2023 13:55:30 +0200
Subject: [PATCH] DOC: document logging and email

---
 CHANGELOG.md                                 |  7 +++
 src/doc/getting_started/index.rst            |  1 +
 src/doc/getting_started/optionalfeatures.rst | 47 ++++++++++++++++++++
 3 files changed, 55 insertions(+)
 create mode 100644 src/doc/getting_started/optionalfeatures.rst

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 315f9545..f211bd80 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ## [Unreleased] ##
 
 ### Added ###
+- Standard logging for server side execution
+- Email notification if the `pycaosdb.ini` contains a `[caoscrawler]` with
+  `send_crawler_notifications=True`.
+- Creation of CrawlerRun Records that contain status information about data
+  integration of the crawler if the `pycaosdb.ini` contains a `[caoscrawler]`
+  with `create_crawler_status_records=True`.
+
 
 ### Changed ###
 
diff --git a/src/doc/getting_started/index.rst b/src/doc/getting_started/index.rst
index 74ffa7da..490c705f 100644
--- a/src/doc/getting_started/index.rst
+++ b/src/doc/getting_started/index.rst
@@ -9,6 +9,7 @@ Getting Started
    Installation<INSTALL>
    prerequisites
    helloworld
+   optionalfeatures
 
 This section will help you get going! From the first installation steps to the first simple crawl.
 
diff --git a/src/doc/getting_started/optionalfeatures.rst b/src/doc/getting_started/optionalfeatures.rst
new file mode 100644
index 00000000..d326d7fc
--- /dev/null
+++ b/src/doc/getting_started/optionalfeatures.rst
@@ -0,0 +1,47 @@
+Optional Features
+=================
+
+Email notifications
+-------------------
+
+The crawler can send email notifications if it made some changes or if
+new data was inserted. This is (currently) only available if the crawler
+runs as server side script of CaosDB. You need to add the following
+section to your ``.pycaosdb.ini``
+
+.. code:: ini
+
+   [caoscrawler]
+   send_crawler_notifications=True
+   public_host_url=https://example..eu
+   sendmail_to_address=someone@example.de
+   sendmail_from_address=caosdb-no-reply@example.eu
+
+This feature uses the ``sendmail`` functionality of
+``caosadvancedtools``. Thus, it uses the setting
+
+.. code:: ini
+
+   [Misc]
+   sendmail = /usr/sbin/sendmail
+   #sendmail = /usr/local/bin/sendmail_to_file
+
+to decide what tool is used for sending mails (use the upper one if you
+want to actually send mails. See ``sendmail`` configuration in the
+LinkAhead docs.
+
+Crawler Status Records
+----------------------
+
+The crawler can insert and update Records that contain essential
+information about the data integration process. This is (currently) only
+available if the crawler runs as server side script of CaosDB. To enable
+this, add the following to your ``.pycaosdb.ini``
+
+.. code:: ini
+
+   [caoscrawler]
+   create_crawler_status_records=True
+
+You also need to add the data model needed for this as desribed by
+``crawler_run_model.yml``.
-- 
GitLab