From 8543d628b53dc3a42ba48c057924d66de06d97d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sat, 16 Mar 2013 02:24:33 +0100 Subject: [PATCH 1/2] New serial log at ~/.octoprint/logs/serial.log Logs the same content as the terminal tab and is restricted to 2MB in size (hopefully). Closes #77 --- octoprint/server.py | 13 +++++++++++-- octoprint/util/comm.py | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/octoprint/server.py b/octoprint/server.py index 9a342da..8ae920a 100644 --- a/octoprint/server.py +++ b/octoprint/server.py @@ -509,11 +509,20 @@ class Server(): "when": "D", "backupCount": "1", "filename": os.path.join(settings().getBaseFolder("logs"), "octoprint.log") + }, + "serialFile": { + "class": "logging.handlers.RotatingFileHandler", + "level": "DEBUG", + "formatter": "simple", + "maxBytes": 2 * 1024 * 1024, # let's limit the serial log to 2MB in size + "filename": os.path.join(settings().getBaseFolder("logs"), "serial.log") } }, "loggers": { - "octoprint.gcodefiles": { - "level": "DEBUG" + "SERIAL": { + "level": "DEBUG", + "handlers": ["serialFile"], + "propagate": False } }, "root": { diff --git a/octoprint/util/comm.py b/octoprint/util/comm.py index 00d63fe..4deb8bf 100644 --- a/octoprint/util/comm.py +++ b/octoprint/util/comm.py @@ -9,6 +9,7 @@ import re import traceback import threading import Queue as queue +import logging import serial @@ -143,6 +144,9 @@ class MachineCom(object): STATE_CLOSED_WITH_ERROR = 10 def __init__(self, port = None, baudrate = None, callbackObject = None): + self._logger = logging.getLogger(__name__) + self._serialLogger = logging.getLogger("SERIAL") + if port == None: port = settings().get(["serial", "port"]) if baudrate == None: @@ -422,6 +426,7 @@ class MachineCom(object): def _log(self, message): self._callback.mcLog(message) + self._serialLogger.debug(message) try: self._logQueue.put(message, False) except: From e1d4832026b468d7080409d77286c337cc9c64cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sat, 16 Mar 2013 02:40:42 +0100 Subject: [PATCH 2/2] Moved configuration description to wiki and removed obsolete information regarding the repository rename. --- README.md | 173 +----------------------------------------------------- 1 file changed, 2 insertions(+), 171 deletions(-) diff --git a/README.md b/README.md index b541626..3cf6f91 100644 --- a/README.md +++ b/README.md @@ -68,162 +68,9 @@ See `run --help` for further information. Configuration ------------- -If not specified via the commandline, the configfile `config.yaml` for OctoPrint is expected in its settings folder, -which is located at `~/.octoprint` on Linux, at `%APPDATA%/OctoPrint` on Windows and at -`~/Library/Application Support/OctoPrint` on MacOS. +If not specified via the commandline, the configfile `config.yaml` for OctoPrint is expected in the settings folder, which is located at ~/.octoprint on Linux, at %APPDATA%/OctoPrint on Windows and at ~/Library/Application Support/OctoPrint on MacOS. -The following example config should explain the available options, most of which can also be configured via the -settings dialog within OctoPrint: - - # Use the following settings to configure the serial connection to the printer - serial: - # Use the following option to define the default serial port, defaults to unset (= AUTO) - port: /dev/ttyACM0 - - # Use the following option to define the default baudrate, defaults to unset (= AUTO) - baudrate: 115200 - - # Use the following settings to configure the web server - server: - # Use this option to define the host to which to bind the server, defaults to "0.0.0.0" (= all interfaces) - host: 0.0.0.0 - - # Use this option to define the port to which to bind the server, defaults to 5000 - port: 5000 - - # Use the following settings to configure webcam support - webcam: - # Use this option to enable display of a webcam stream in the UI, e.g. via MJPG-Streamer. - # Webcam support will be disabled if not set - stream: http://:/?action=stream - - # Use this option to enable timelapse support via snapshot, e.g. via MJPG-Streamer. - # Timelapse support will be disabled if not set - snapshot: http://:/?action=snapshot - - # Path to ffmpeg binary to use for creating timelapse recordings. - # Timelapse support will be disabled if not set - ffmpeg: /path/to/ffmpeg - - # The bitrate to use for rendering the timelapse video. This gets directly passed to ffmpeg. - bitrate: 5000k - - # Use the following settings to enable or disable OctoPrint features - feature: - # Whether to enable the gcode viewer in the UI or not - gCodeVisualizer: true - - # Specified whether OctoPrint should wait for the start response from the printer before trying to send commands - # during connect - waitForStartOnConnect: false - - # Use the following settings to set custom paths for folders used by OctoPrint - folder: - # Absolute path where to store gcode uploads. Defaults to the uploads folder in the OctoPrint settings folder - uploads: /path/to/upload/folder - - # Absolute path where to store finished timelapse recordings. Defaults to the timelapse folder in the OctoPrint - # settings dir - timelapse: /path/to/timelapse/folder - - # Absolute path where to store temporary timelapse files. Defaults to the timelapse/tmp folder in the OctoPrint - # settings dir - timelapse_tmp: /path/to/timelapse/tmp/folder - - # Absolute path where to store log files. Defaults to the logs folder in the OctoPrint settings dir - logs: /path/to/logs/folder - - # Use the following settings to configure temperature profiles which will be displayed in the temperature tab. - temperature: - profiles: - - name: ABS - extruder: 210 - bed: 100 - - name: PLA - extruder: 180 - bed: 60 - - # Use the following settings to configure printer parameters - printerParameters: - # Use this to define the movement speed on X, Y, Z and E to use for the controls on the controls tab - movementSpeed: - x: 6000 - y: 6000 - z: 200 - e: 300 - - # Use the following settings to tweak OctoPrint's appearance a bit to better distinguish multiple instances/printers - appearance: - # Use this to give your printer a name. It will be displayed in the title bar (as " [OctoPrint]") and in the - # navigation bar (as "OctoPrint: ") - name: My Printer Model - - # Use this to color the navigation bar. Supported colors are red, orange, yellow, green, blue, violet and default. - color: blue - - # Use the following settings to add custom controls to the "Controls" tab within OctoPrint - # - # Controls consist at least of a name, a type and type-specific further attributes. Currently recognized types are - # - section: Creates a visual section in the UI, you can use this to separate functional blocks - # - command: Creates a button that sends a defined GCODE command to the printer when clicked - # - commands: Creates a button that sends multiple defined GCODE commands to the printer when clicked - # - parametric_command: Creates a button that sends a parameterized GCODE command to the printer, parameters - # needed for the command are added to the UI as input fields, are named and can such be referenced from the command - # - parametric_commands: Like parametric_command, but supports multiple commands - # - # The following example defines a control for enabling the cooling fan with a variable speed defined by the user - # (default 255) and a control for disabling the fan, all within a section named "Fan", and two example controls with - # multiple commands in a section "Example for multiple commands". - controls: - - name: Fan - type: section - children: - - name: Enable Fan - type: parametric_command - command: M106 S%(speed)s - input: - - name: Speed (0-255) - parameter: speed - default: 255 - - name: Disable Fan - type: command - command: M107 - - name: Example for multiple commands - type: section - children: - - name: Move X (static) - type: commands - commands: - - G91 - - G1 X10 F3000 - - G90 - - name: Move X (parametric) - type: parametric_commands - commands: - - G91 - - G1 X%(distance)s F%(speed)s - - G90 - input: - - default: 10 - name: Distance - parameter: distance - - default: 3000 - name: Speed - parameter: speed - - # Use the following settings to add custom system commands to the "System" dropdown within OctoPrint's top bar - # - # Commands consist of a name, an action identifier, the commandline to execute and an optional confirmation message - # to display before actually executing the command (should be set to False if a confirmation dialog is not desired). - # - # The following example defines a command for shutting down the system under Linux. It assumes that the user under - # which OctoPrint is running is allowed to do this without password entry. - system: - actions: - - name: Shutdown - action: shutdown - command: sudo shutdown -h now - confirm: You are about to shutdown the system. +A comprehensive overview of all available configuration settings can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki/Configuration). Setup on a Raspberry Pi running Raspbian ---------------------------------------- @@ -263,19 +110,3 @@ Why is it called OctoPrint and what's with the crystal ball in the logo? ------------------------------------------------------------------------ It so happens that I needed a favicon and also OctoPrint's first name -- Printer WebUI -- simply lacked a certain coolness to it. So I asked The Internet(tm) for advise. After some brainstorming, the idea of a cute Octopus watching his print job remotely through a crystal ball was born... [or something like that](https://plus.google.com/u/0/106003970953341660077/posts/UmLD5mW8yBQ). - -What do I have to do after the rename from Printer WebUI to OctoPrint? ----------------------------------------------------------------------- - -If you did checkout OctoPrint from its previous location at https://github.com/foosel/PrinterWebUI.git, you'll have to -update your so-called remote references in git in order to make `git pull` use the new repository location as origin. - -To do so you'll only need to execute the following command in your OctoPrint/PrinterWebUI folder: - - git remote set-url origin https://github.com/foosel/OctoPrint.git - -After that you might also want to rename your base directory (which probably still is called `PrinterWebUI`) to `OctoPrint` -and delete the folder `printer_webui` in your base folder (which stays there thanks to Python's compiled bytecode files -even after a rename of the Python package to `octoprint`). - -After that you are set, the configuration files are migrated automatically.