Skip to content

Restore ability for scripts to be able to log_success without generating a message #16307

Closed
@candlerb

Description

@candlerb

NetBox version

v4.0.3

Feature type

Change to existing functionality

Proposed functionality

Make log_success(None, None) and/or log_success("", None) increment the success counter without generating a log message

Use case

Reports in Netbox <= v3.7 were able to do this:

self.log_success(obj)

This would increment the success counter for the report without generating any message: e.g.

image

However, in Netbox 4.0, when upgrading a Report to a Script, you need to change it to:

self.log_success("", obj)
or
self.log_success(None, obj)
or
self.log_success(None, None)

All of these log a message: a dash in the first case, or the string "None" in the second and third. (The third log line has no URL).

Either way, if you have thousands of successful checks, this generates thousands of log lines to wade through.

I note from the documentation of v3.7 that omitting the message for log_success() in Reports was explicitly permitted, and defaulted to None:

* log(message)
* log_success(object, message=None)
* log_info(object, message)
* log_warning(object, message)
* log_failure(object, message)

Maybe also log_success() with no arguments should be allowed, since the object identity isn't actually being used if no message is being recorded. It would be equivalent to log_success(None, None)


Possibly relates to #8984, although I think that this feature request is orthogonal.

Database changes

None

External dependencies

None

Metadata

Metadata

Labels

complexity: lowRequires minimal effort to implementstatus: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions