How to make new Logs

At the end of this tutorial, you will be able to do new logs; that will help you to filter the background process of your interest.Let’s do it step by step.

1. How to use Parser’s Cloud Code

First of all, you will need this doc https://docs.back4app.com/docs/ios/cloud-code-with-swift-apps/
After click on this link and roll down the cursor, you will be here

Captura de Tela 2017-01-12 às 10.27.34

2. Create the javascript files and add functions as you wish

Look the next example:

Captura de Tela 2017-01-12 às 10.33.17

It’s just a function that print on the dashboard

3. Upload the JavaScript files to back4app cloud:

Enter on https://www.back4app.com

Captura de Tela 2017-01-12 às 10.42.05

 

Click on the blue box on the up and right side of the page

Captura de Tela 2017-01-12 às 10.43.42

Enter with your e-mail and password and Click on the blue box LOGIN

Captura de Tela 2017-01-12 às 10.44.41

Now that you are logged in your account , localize the card of the app you wish work with

Captura de Tela 2017-01-12 às 10.47.53

 

Captura de Tela 2017-01-12 às 10.48.34

Click on the second box FEATURES

Captura de Tela 2017-01-12 às 10.49.39

At this time, you will be here

Captura de Tela 2017-01-12 às 10.50.10

Roll a little the cursor, the CloudCode card is the first on the second column

Captura de Tela 2017-01-12 às 11.00.30

Click on SERVER at the end of the card

Captura de Tela 2017-01-12 às 11.02.54

 

Click on the box Escolher Arquivos, on the left side of the page

Captura de Tela 2017-01-12 às 11.04.18

At this case, I selected the file MAIN.JS

Captura de Tela 2017-01-13 às 12.09.36

Click on the box ESCOLHER

Captura de Tela 2017-01-13 às 12.09.51

Click on OK

Captura de Tela 2017-01-13 às 12.09.58

Captura de Tela 2017-01-13 às 13.08.29

After this, click on the green box SAVE at the down right side of the page

Captura de Tela 2017-01-13 às 13.09.15

4. Calling the function at the terminal

 

Now, We will use the terminal and use this code

Captura de Tela 2017-01-13 às 13.11.42

But first, We need to know where are Application ID and Rest API key; So, after we saved our node archive, We will be on this page

Captura de Tela 2017-01-13 às 13.15.06

Localize the first card of the first column

Captura de Tela 2017-01-13 às 13.15.12

Click on SERVER

Captura de Tela 2017-01-13 às 13.15.18

We are at this page

Captura de Tela 2017-01-13 às 13.17.15

copy the App Id

Captura de Tela 2017-01-13 às 13.21.16

Glue on the code replacing this part for the App Id

Captura de Tela 2017-01-13 às 13.23.52

Captura de Tela 2017-01-13 às 13.11.42

It will look like this

Captura de Tela 2017-01-13 às 13.26.34

We have to do the same steps to replace the Rest API key, so, let’s go back to this page

Captura de Tela 2017-01-13 às 13.17.15

Rolling the cursor a little,We will find the Rest API Key

Captura de Tela 2017-01-13 às 13.29.11

Captura de Tela 2017-01-13 às 13.29.18

Copy the key and glue at this part of the code

Captura de Tela 2017-01-13 às 13.30.42

 

Captura de Tela 2017-01-13 às 13.26.34

It will look like this

Captura de Tela 2017-01-13 às 13.32.35

Pay attention to the end of the code

Captura de Tela 2017-01-13 às 13.34.03

You have to replace the end of the code for the name of your function

Captura de Tela 2017-01-13 às 13.34.15

At this example,the name of my function is printing

Captura de Tela 2017-01-13 às 13.36.28

Captura de Tela 2017-01-13 às 13.36.32

We have completed the coding process;it will be like this

Captura de Tela 2017-01-13 às 13.37.49

Now, copy the code, paste on the terminal and run

Captura de Tela 2017-01-13 às 13.40.10

5. Seeing at the server system log the one that we have done

Let’s see the Log that we have done.Again at this page, roll the cursor down to the end of the page

Captura de Tela 2017-01-13 às 13.17.15

 

Captura de Tela 2017-01-13 às 13.50.12

 

Click on the green box ‘back’

Captura de Tela 2017-01-13 às 13.50.16

You arrived here

Captura de Tela 2017-01-13 às 13.52.42

Localize the Logs card; It’s the fourth in the first column

Captura de Tela 2017-01-13 às 13.52.47

Look at the downside of the card and click on SERVER
Captura de Tela 2017-01-13 às 13.56.57

Captura de Tela 2017-01-13 às 13.52.59We are close to the end of the process

Captura de Tela 2017-01-13 às 14.01.48

Roll the cursor down until you look SERVER SYSTEM LOG

Captura de Tela 2017-01-13 às 14.01.56

Your Log was homologated

Captura de Tela 2017-01-13 às 14.02.10

Captura de Tela 2017-01-13 às 14.02.15

Now that you know how to do Logs, do it as you wish.