From 198353b2141f1e4438f9e63053e9a0e01c01023d Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Mon, 28 Jul 2025 13:56:56 +0200 Subject: [PATCH] refs #2537 log whether we are in ogLive or not --- CHANGELOG.md | 6 ++++++ linux/debian/changelog | 6 ++++++ src/VERSION | 2 +- src/opengnsys/linux/log.py | 7 ++++++- src/opengnsys/windows/log.py | 4 +++- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f403eb..0ae1e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.2.0] - 2025-07-28 + +### Added + +- Log whether we are in ogLive or not + ## [7.1.0] - 2025-07-24 ### Changed diff --git a/linux/debian/changelog b/linux/debian/changelog index 5e24879..439a510 100644 --- a/linux/debian/changelog +++ b/linux/debian/changelog @@ -1,3 +1,9 @@ +ogagent (7.2.0-1) stable; urgency=medium + + * Log whether we are in ogLive or not + + -- OpenGnsys developers Mon, 28 Jul 2025 13:55:28 +0200 + ogagent (7.1.0-1) stable; urgency=medium * Don't pass the "tag" parameter to CrearImagenGit diff --git a/src/VERSION b/src/VERSION index a3fcc71..0ee843c 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -7.1.0 +7.2.0 diff --git a/src/opengnsys/linux/log.py b/src/opengnsys/linux/log.py index 934bfa9..77617d6 100644 --- a/src/opengnsys/linux/log.py +++ b/src/opengnsys/linux/log.py @@ -42,6 +42,8 @@ OTHER, DEBUG, INFO, WARN, ERROR, FATAL = (10000 * (x + 1) for x in range(6)) class LocalLogger(object): def __init__(self): + self.extra = { 'in_oglive': None } + # tempdir is different for "user application" and "service" # service wil get c:\windows\temp, while user will get c:\users\XXX\temp # Try to open logger at /var/log path @@ -77,11 +79,14 @@ class LocalLogger(object): self.logger = None def log(self, level, message): + if self.extra['in_oglive'] is None: + self.extra['in_oglive'] = os.path.exists ('/scripts/functions') + # Debug messages are logged to a file # our loglevels are 10000 (other), 20000 (debug), .... # logging levels are 10 (debug), 20 (info) # OTHER = logging.NOTSET - self.logger.log(int(level / 1000) - 10, message, stacklevel=4) + self.logger.log(int(level / 1000) - 10, message, stacklevel=4, extra=self.extra) def isWindows(self): return False diff --git a/src/opengnsys/windows/log.py b/src/opengnsys/windows/log.py index 05f81f3..5b322f4 100644 --- a/src/opengnsys/windows/log.py +++ b/src/opengnsys/windows/log.py @@ -44,6 +44,8 @@ OTHER, DEBUG, INFO, WARN, ERROR, FATAL = (10000 * (x + 1) for x in range(6)) class LocalLogger(object): def __init__(self): + self.extra = { 'in_oglive': False } + # tempdir is different for "user application" and "service" # service wil get c:\windows\temp, while user will get c:\users\XXX\appdata\local\temp @@ -71,7 +73,7 @@ class LocalLogger(object): # our loglevels are 10000 (other), 20000 (debug), .... # logging levels are 10 (debug), 20 (info) # OTHER = logging.NOTSET - self.logger.log(int(level / 1000 - 10), message, stacklevel=4) + self.logger.log(int(level / 1000 - 10), message, stacklevel=4, extra=self.extra) if level < INFO or self.serviceLogger is False: # Only information and above will be on event log return